public bool SelectNode(Type nodeType, int id, int subId)
        {
            var r = FindNode(id, nodeType);

            if (r != null)
            {
                SetSelectedState(r);
                ExpandParent(r);

                r.IsExpanded = true;

                TreeViewItem selectedNode = null;
                foreach (TreeViewItem node in r.Items)
                {
                    IEntity idObj = node.Tag as IEntity;
                    if (idObj.Id == subId)
                    {
                        node.IsSelected = true;
                        node.Foreground = Brushes.Red;

                        selectedNode = node;
                    }
                }

                TreeView1.ScrollTo(r);

                TreeView1.ScrollTo(selectedNode);
            }
            return(r != null);
        }