public Book GetBook(int authorId, int id) { ValidateAuthor(authorId); var book = authorsRepository.GetBook(id); if (book == null) { throw new NotFoundException("invalid book"); } if (book.AuthorId != authorId) { throw new NotFoundException("book does not exist"); } return(book); }