private static void InteractiveRemoveReadOnlyTags()
        {
            List <ENSessionFindNotesResult> readOnlyNotes = FindNotes(READONLY_TAG_SEARCH);

            Console.WriteLine("all readonly notes: " + readOnlyNotes.Count);
            Debug.WriteLine("all readonly notes: " + readOnlyNotes.Count);

            foreach (ENSessionFindNotesResult readOnlyNote in readOnlyNotes)
            {
                Console.WriteLine(string.Format("Untag '{0}'?", readOnlyNote.Title));
                Console.Write("Y / N: ");

                if ("Y" == Console.ReadLine().ToUpper())
                {
                    ENNoteRef         noteRef   = readOnlyNote.NoteRef;
                    ENNoteStoreClient noteStore = ENSessionAdvanced.SharedSession.NoteStoreForNoteRef(noteRef);
                    List <string>     tagGuids  = noteStore.GetNoteTagNames(noteRef.Guid);
                    List <Tag>        tags      = noteStore.ListTags();
                    Tag  readOnlyTag            = tags.Find(x => x.Name.Contains(READONLY_TAG));
                    Note loadedNote             = noteStore.GetNote(noteRef.Guid, true, false, false, false);

                    loadedNote.TagGuids.Remove(readOnlyTag.Guid);
                    noteStore.UpdateNote(loadedNote);
                    Console.WriteLine("Removed readonly tag: " + readOnlyNote.Title);
                    Debug.WriteLine("Removed readonly tag: " + readOnlyNote.Title);
                }
                else
                {
                    Console.WriteLine("Skipped: " + readOnlyNote.Title);
                    Debug.WriteLine("Skipped: " + readOnlyNote.Title);
                }
            }
        }
        private static void ResetUntaggedNotesToReadWrite()
        {
            // find notes with the contentClass but no tag
            List <ENSessionFindNotesResult> untaggedNotes = FindNotes(READONLY_NOTAG_CONTENT_CLASS_SEARCH);

            Console.WriteLine("untagged notes to reset to r/w: " + untaggedNotes.Count);
            Debug.WriteLine("untagged notes to reset to r/w: " + untaggedNotes.Count);

            // Clear the contentClass for anything without the ReadOnly tag
            foreach (ENSessionFindNotesResult noteToSetReadWrite in untaggedNotes)
            {
                ENNoteRef         noteRef   = noteToSetReadWrite.NoteRef;
                ENNoteStoreClient noteStore = ENSessionAdvanced.SharedSession.NoteStoreForNoteRef(noteRef);
                List <string>     tags      = noteStore.GetNoteTagNames(noteRef.Guid);
                Note loadedNote             = noteStore.GetNote(noteRef.Guid, true, false, false, false);

                loadedNote.Attributes.ContentClass = null;
                noteStore.UpdateNote(loadedNote);
            }
        }
        private static void SetTaggedNotesToReadOnly()
        {
            // find notes with readonly tag but no contentClass
            List <ENSessionFindNotesResult> notesToSetReadOnly = FindNotes(READONLYTAG_NOCONTENTCLASS_SEARCH);

            Console.WriteLine("newly-tagged notes to mark readonly: " + notesToSetReadOnly.Count);
            Debug.WriteLine("newly-tagged notes to mark readonly: " + notesToSetReadOnly.Count);

            // add r/o contentClass to every found note (with r/o tag)
            foreach (ENSessionFindNotesResult noteToSetReadOnly in notesToSetReadOnly)
            {
                ENNoteRef         noteRef   = noteToSetReadOnly.NoteRef;
                ENNoteStoreClient noteStore = ENSessionAdvanced.SharedSession.NoteStoreForNoteRef(noteRef);
                Note loadedNote             = noteStore.GetNote(noteRef.Guid, true, false, false, false);
                if (null == loadedNote.Attributes.ContentClass)
                {
                    loadedNote.Attributes.ContentClass = READONLY_CONTENT_CLASS;
                    noteStore.UpdateNote(loadedNote);
                }
            }
        }