private IEditorTreeNode ProcessTreeNode(IReadOnlyItem item)
 {
   switch (item.Classification().Value.ToLowerInvariant())
   {
     case "tree node/savedsearchintoc":
       return new EditorTreeNode()
       {
         Name = item.Property("label").Value,
         Description = "Saved Search",
         ImageKey = "xml-tag-16",
         HasChildren = item.Relationships("Tree Node Child").Any(),
         Children = item.Relationships().Select(r => ProcessTreeNode(r.RelatedItem())),
         ScriptGetter = () => Enumerable.Repeat(
           new EditorScript() {
             Name = item.Property("label").Value,
             Action = "ApplyItem",
             Script = _conn.Apply("<Item type='SavedSearch' action='get' select='criteria' id='@0' />", item.Property("saved_search_id").Value)
               .AssertItem().Property("criteria").Value
           }, 1)
       };
     case "tree node/itemtypeintoc":
       return new EditorTreeNode()
       {
         Name = item.Property("label").Value,
         ImageKey = "class-16",
         Description = "ItemType: " + item.Property("name").Value,
         HasChildren = true,
         ScriptGetter = () => ItemTypeScripts(ArasMetadataProvider.Cached(_conn).TypeById(item.Property("itemtype_id").Value)),
         Children = ItemTypeChildren(item.Property("itemtype_id").Value)
         .Concat(item.Relationships().Select(r => ProcessTreeNode(r.RelatedItem())))
       };
     default:
       return new EditorTreeNode()
       {
         Name = item.Property("label").Value,
         ImageKey = "folder-16",
         HasChildren = item.Relationships("Tree Node Child").Any(),
         Children = item.Relationships().Select(r => ProcessTreeNode(r.RelatedItem()))
       };
   }
 }