public void AddChild(TreeItem item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (item.Parent != null) { throw new InvalidOperationException(); } _items.Add(item); item.Parent = this; }