public void RemoveCollectionsRecursive() { if (this.IsVirtual) { this.ParentItem?.ChildItems.Remove(this); foreach (var child in ChildItems) { this.ParentItem?.ChildItems.Add(child); } } var childs = ChildItems.ToArray(); foreach (var child in childs) { child.RemoveCollectionsRecursive(); } }