public void DestroyControl(ILayoutable item) { if (item == null) { return; } _items.Remove(item); item.Destroy(); // If the control is selectable and is in a control group, remove it var selectable = item as ISelectable; if (selectable != null) { foreach (var group in _selectableControlGroups) { if (group.Contains(selectable)) { group.Remove(selectable); } } } }