void rootEntities_CollectionChanged(object sender, TrackingCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: EntitySystem.Add((Entity)e.Item); break; case NotifyCollectionChangedAction.Remove: EntitySystem.Remove((Entity)e.Item); break; default: throw new NotSupportedException(); } }