public void Save() { Book book = new Book() { Author = Author, Title = Title, Status = BookStatus.Available }; if (!String.IsNullOrWhiteSpace(ImagePath)) { book.Cover = BooksModel.GetCoverBytes(ImagePath); } if (Id.HasValue) { BooksModel.UpdateBook(Id.Value, book); } else { BooksModel.CreateBook(book); } closeWindow(); }