public async Task <IActionResult> Create([Bind("Id,Title")] BookCreateCommand command)
        {
            if (ModelState.IsValid)
            {
                var result = await _mediator.Send(command);

                //_context.Add(book);
                //await _context.SaveChangesAsync();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(command));
        }
        public async Task <Book> CreateBookAsync(BookCreateCommand createCommand)
        {
            var existingBook = await _repository.FindBookByAsinAsync(createCommand.Asin);

            if (existingBook != null)
            {
                throw new ConflictEntityException("Book already exists", existingBook.BookId);
            }

            var book = new Book(createCommand);
            await _repository.CreateBookAsync(book);

            return(book);
        }