/// <summary>
        /// This method will insert currentTestTypeRootNode between child nodes of this currentTestTypeRootNode
        /// </summary>
        internal void InsertChildNode(TreeNode childNode)
        {
            Debug.Assert(childNode.TreeView == null, "childNode.TreeView must be null otherwise it will not be added to children collection");
            //we need to safe
            using (SynchronizationManager.Lock())
            {
                //add this new children to collection
                AddChildrenNodesToTreeNode(new TreeNode[] { childNode }, false, true);

                this._newChildElementInserted = true;
            }
        }
/*        /// <summary>
 *      /// this method will clear child nodes and set state to children not populated
 *      /// </summary>
 *      private void ClearChildNodes()
 *      {
 *          //this call this this.TreeView.Nodes.Clear() on the right thread
 *          AddChildrenNodesToTreeNode(new TreeNode[] { }, true);
 *
 *          this._childrenStatus = ChildrenElementsStatus.NotPopulated;
 *          this._newChildElementInserted = false;
 *      }*/

        /// <summary>
        /// this method will find AutomatinElementTreeNode for automationElement in children collection
        /// </summary>
        public AutomationElementTreeNode FindChildNodeForAutomationElement(AutomationElement automationElement)
        {
            using (SynchronizationManager.Lock())
            {
                //if children has been polupated then find the element
                if (this._childrenStatus == ChildrenElementsStatus.Populated)
                {
                    return(FindChildNodeForAutomationElementInternal(automationElement));
                }
                //if not then return null
                return(null);
            }
        }
        /// <summary>
        /// This method will refresh children nodes
        /// </summary>
        public void RefreshChildrenNodes()
        {
            using (SynchronizationManager.Lock())
            {
                if (this._childrenStatus != ChildrenElementsStatus.NotPopulated)
                {
                    this._childrenStatus = ChildrenElementsStatus.NotPopulated;
                    SetTreeNodeImageIndex();

                    CreateChildrenNodes(true);
                }
            }
        }