private void handleChanged(TECChangedEventArgs obj) { if (obj.Sender is TECBid && obj.Value is TECTypical typ) { if (obj.Change == Change.Add) { if (typ.Instances.Count != 1) { TypicalSystems.Add(typ); } else { Singletons.Add(typ); } } else if (obj.Change == Change.Remove) { TypicalSystems.Remove(typ); Singletons.Remove(typ); } } else if (obj.Sender is TECTypical typParent && obj.Value is TECSystem) { if (typParent.Instances.Count == 1) { TypicalSystems.Remove(typParent); Singletons.Add(typParent); } else { Singletons.Remove(typParent); if (!TypicalSystems.Contains(typParent)) { TypicalSystems.Add(typParent); } } } }