/// <summary>
        /// Initializes and populates bookInventory with Book objects from database context.
        /// </summary>
        private void LoadToBookInventory()
        {
            //Get a list of Book objects from database context
            var dbBooks = (from b in context.Books
                           select b).ToList();

            //create and assign bookInventory
            bookInventory = new BookInventory(dbBooks);
        }
        ////Returns a generic list of all Book objects in bookInventory whose ISBN contains the string in the argument.
        //public List<Book> SearchByISBN(string isbn)
        //{
        //    var result = (from b in bookInventory
        //                  where b.ISBN.ToLower().Contains(isbn.ToLower())
        //                  select b).ToList();

        //    return result;
        //}



        ////Returns a generic list of all Book objects in bookInventory whose title contains the the string in the argument.
        //public List<Book> SearchByTitle(string title)
        //{
        //    var result = (from b in bookInventory
        //                  where b.Title.ToLower().Contains(title.ToLower())
        //                  select b).ToList();

        //    return result;
        //}

        ////Returns a generic list of all Book objects in bookInventory whose author's first name or last name contains
        ////the string in the argument.
        //public List<Book> SearchByAuthor(string author)
        //{
        //    var result = (from b in bookInventory
        //                  where b.Author.Person.FirstName.ToLower().Contains(author.ToLower()) ||
        //                        b.Author.Person.LastName.ToLower().Contains(author.ToLower())
        //                  select b).ToList();

        //    return result;
        //}

        ////Returns a generic list of all Book objects in bookInventory whose subject contains the string in the argument.
        //public List<Book> SearchBySubject(string subject)
        //{
        //    var result = (from b in bookInventory
        //                  where b.Subject.ToLower().Contains(subject.ToLower())
        //                  select b).ToList();

        //    return result;
        //}

        /// <summary>
        /// Finds all Book objects in the collection that contain the search token
        /// </summary>
        /// <param name="searchToken">string used to find Book objects</param>
        /// <returns>Returns a BookInventory that contains all Book objects in this collection that match the search token</returns>
        public BookInventory FindAll(string searchToken)
        {
            string        token  = searchToken.ToLower();
            BookInventory result = new BookInventory();

            foreach (Book b in bookInventory)
            {
                if (b.ContainsToken(token))
                {
                    result.Add(b);
                }
            }

            return(result);
        }
        /// <summary>
        /// Retrives a list of all Book objects in collection that contain the searchToken
        /// </summary>
        public void LoadSearchList()
        {
            //reset ItemsSource
            ResultsListView.ItemsSource = null;

            //Obtain search results
            BookInventory results = controller.SearchBookInventory(this.searchToken);

            //Copy search results to observable collection which is filtered depending on user type
            ObservableCollection <Book> filtered = new ObservableCollection <Book>();

            //if the user is a patron, do not show any Book objects that have 0 total copies
            foreach (Book b in results)
            {
                if (b.NumberOfCopies == 0)
                {
                    if (controller.IsLibrarian)
                    {
                        filtered.Add(b);
                    }
                }
                else
                {
                    filtered.Add(b);
                }
            }

            //Bind the filtered list
            ResultsListView.ItemsSource = filtered;

            //Update HasResult property based on the filtered count
            if (filtered.Count == 0)
            {
                HasResult = false;
            }
            else
            {
                HasResult = true;
            }
        }