public virtual void AddChild(IProjectItem child) { for (IProjectItem i = this.Parent; i != null; i = i.Parent) { if (i == child) { return; } } IProjectItem parent = child.Parent; if (parent != null) { parent.RemoveChild(child); } this.children.Add(child); child.Parent = this; }