private void AddBook(BookAmount bookAmount)
        {
            if (bookAmount == null)
            {
                return;
            }

            var orderedBook = Order.OrderedBooks.FirstOrDefault(ob => ob.BookId == bookAmount.BookId);

            if (orderedBook == null)
            {
                orderedBook = new OrderedBook
                {
                    Amount = 1,
                    Book = bookAmount.Book,
                    BookId = bookAmount.BookId,
                    Order = Order,
                    OrderId = Order.Id,
                    Price = bookAmount.Book.Price
                };

                Order.OrderedBooks.Add(orderedBook);
            }
        }
        private void Search()
        {
            using (StartOperation())
            {
                if (ISBN.IsNullOrEmpty() && SearchString.IsNullOrEmpty())
                {
                    Amounts = new BookAmount[] { };
                    return;
                }

                var query = RepositoryProvider.GetRepository<BookAmount>()
                .GetAll(ba => ba.Book.Writers)
                .Where(ba => ba.BranchId == Employee.BranchId);

                if (!ISBN.IsNullOrEmpty())
                {
                    query = query.Where(ba => ba.Book.ISBN.Contains(ISBN));
                }
                else if (!SearchString.IsNullOrEmpty())
                {
                    query = query.Where(ba => ba.Book.Title.Contains(SearchString) ||
                                              ba.Book.Writers.Any(w => w.LastName.Contains(SearchString)));
                }

                Amounts = query.ToList();
            }
        }