public ActionResult BookUpdate(int id, Book newBook)
        {
            var book = books.Where(b => b.id == id).FirstOrDefault();
            if (book==null) throw new Exception("Book does not exist");

            books.Remove(book);
            books.Add(newBook);
            return Json(newBook);
        }
 public ActionResult BookCreate(Book book)
 {
     book.id = GetNextId();
     books.Add(book);
     return Json(book);
 }