/// <summary>
        /// Adds a new Book to database context and to local memory collection.
        /// Raises <event>OnDatabaseError</event> when exception is thrown from changing the database context.
        /// </summary>
        /// <param name="book">Book object to be added</param>
        /// <returns>Returns true if operation is successful, false otherwise</returns>
        public bool AddBook(Book book)
        {
            if (!IsLibrarian)
            {
                return(false);               //if not a librarian return false
            }
            try
            {
                //add book to database context
                context.Books.Add(book);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                //send OnDatabaseError event
                while (ex != null)
                {
                    ex = ex.InnerException;
                }
                DatabaseEventArgs e = new DatabaseEventArgs(ex.Message);
                OnDatabaseErrorRaised(e);
                return(false);
            }

            bookInventory.Add(book);

            return(true);
        }
        ////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);
        }