public TreeItem(string title, List<TreeItem> children, TreeItem parent = null)
        {
            this.Title = title;
            this.Parent = parent;
            this.Children = children;

            if (this.Children != null)
            {
                this.Children.ForEach(ch => ch.Parent = this);
            }
        }
 public TreeItem(int id, string title, List<TreeItem> children, TreeItem parent = null)
     : this(title, children, parent)
 {
     this.Id = id;
 }
 /// <summary>
 /// Finds the tree item by identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="treeItems">The tree items.</param>
 /// <param name="outtreeItem">The out tree item.</param>
 private static void FindTreeItemById(int id, IEnumerable<TreeItem> treeItems, ref TreeItem outtreeItem)
 {
     if (null == treeItems) return;
     foreach (var treeItem in treeItems)
     {
         if (treeItem.Id == id)
             outtreeItem = treeItem;
         FindTreeItemById(id, treeItem.Children, ref outtreeItem);
     }
 }