public bool AssignBorrowerToBook(AddBookBorrowerViewModel addBookBorrowerViewModel) { if (!_repository.IsBookBorrowed(addBookBorrowerViewModel.BookId)) { _validatonDictionary.AddError(ErrorMessages.BookNotFoundHeading, ErrorMessages.BookNotFoundMessage); } else if (!_repository.IsBorrowerExists(addBookBorrowerViewModel.BorrowerId)) { _validatonDictionary.AddError(ErrorMessages.BorrowerNotFoundHeading, ErrorMessages.BorrowerNotFoundMessage); } if (_validatonDictionary.IsValid) { _repository.AssignBookToBorrower(addBookBorrowerViewModel); return(true); } else { return(false); } }