/// <summary>
        /// Removes Book object in the argument from database context and local memory collection.
        /// Raises <event>OnDatabaseError</event> when exception is caught from attempting to change the database context.
        /// </summary>
        /// <param name="b">Book object to be removed</param>
        /// <returns>returns true if operation is successful, false otherwise.</returns>
        public bool RemoveBook(Book b)
        {
            if (!IsLibrarian)
            {
                return(false);   //return false if IsLibrarian is false.
            }
            if (b.IsCheckedOut)  //check if books are checked out or not
            {
                OnDatabaseErrorRaised(new DatabaseEventArgs("Cannot remove book, all copies must be checked in"));
                return(false);
            }
            else  //books are all checked in
            {
                try
                {
                    //remove from database
                    context.Books.Remove(b);
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                    while (ex != null)
                    {
                        ex = ex.InnerException;
                    }
                    DatabaseEventArgs e = new DatabaseEventArgs(ex.Message);
                    OnDatabaseErrorRaised(e);
                    return(false);
                }

                //remove from memory
                bookInventory.Remove(b);

                return(true);
            }
        }