private void SetNotes(BookData bookData)
        {
            var bookdb = BookDataContext.Get();

            if (bookData == null)
            {
                // Do a refresh as needed
                bookData = CurrBookData;
                if (bookData == null)
                {
                    return; // very uncommon -- perhaps race conditions and startup?
                }
            }
            CurrBookData = bookData;
            Notes.Clear();
            var bookId = CurrBookData.BookId;
            var bn     = CommonQueries.BookNotesFind(bookdb, bookId);

            if (bn == null)
            {
                ;
            }
            else if (bn.Notes != null)
            {
                var sorted = bn.Notes.OrderBy(note => note.LocationNumericValue).ToList();
                foreach (var note in sorted)
                {
                    Notes.Add(new UserNoteWithTitle(note, false));
                }
            }
        }
        private void DeleteNotes_Click(object sender, RoutedEventArgs e)
        {
            var bookdb = BookDataContext.Get();

            UserNoteWithTitle[] list = new UserNoteWithTitle[uiList.SelectedItems.Count];
            int i = 0;

            foreach (var item in uiList.SelectedItems)
            {
                list[i++] = item as UserNoteWithTitle;
            }
            foreach (var note in list)
            {
                Notes.Remove(note);
                var bookId = note.BookId;
                var bn     = CommonQueries.BookNotesFind(bookdb, bookId);
                if (bn == null)
                {
                    ;
                }
                else if (bn.Notes != null)
                {
                    bn.Notes.Remove(note.BaseNote);
                }
            }
            CommonQueries.BookSaveChanges(bookdb);
        }