@RequestMapping(method = RequestMethod.POST)
  @JsonView(Book.MinimalView.class)
  public Book addBook(@Valid @RequestBody Book book) {
    if (repository.exists(book.getIsbn())) {
      throw new BookAlreadyExistsException();
    }

    return repository.save(book);
  }
  @RequestMapping(value = "/{isbn}", method = RequestMethod.PUT)
  @JsonView(Book.MinimalView.class)
  public Book updateBook(@PathVariable String isbn, @Valid @RequestBody Book book) {
    Book existingBook = repository.findOne(isbn);
    if (existingBook == null) {
      throw new BookNotFoundException();
    }

    existingBook.setTitle(book.getTitle());
    existingBook.setDescription(book.getDescription());
    existingBook.setAuthors(book.getAuthors());

    return repository.save(existingBook);
  }