public void DeleteSelectedObject(ITreeNode selectedObject)
 {
     if (selectedObject != null)
     {
         foreach (ITreeNode nestedObject in selectedObject.Children)
         {
             var id = String.Concat(GetMemberValue((nestedObject as Object), collection.ObjectSpace.GetKeyPropertyName(nestedObject.GetType())));
             if (MarkedObjects.Contains(id))
             {
                 MarkedObjects.Remove(id);
             }
             DeleteSelectedObject(nestedObject);
         }
     }
 }
        public virtual void CalcNestedSelectedObjects(ITreeNode obj, Boolean parentStatus)
        {
            if (obj == null)
            {
                return;
            }
            var children = GetChildren(obj);

            foreach (ITreeNode child in children)
            {
                var status = false;
                if (parentStatus == !MarkedObjects.Contains(String.Concat(GetMemberValue((child as Object), collection.ObjectSpace.GetKeyPropertyName(child.GetType())))))
                {
                    SelectedObjects.Add(child as Object);
                    status = true;
                }
                CalcNestedSelectedObjects(child, status);
            }
        }