private void FixupInvoiceLines(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (InvoiceLine item in e.NewItems) { item.Track = this; } } if (e.OldItems != null) { foreach (InvoiceLine item in e.OldItems) { if (ReferenceEquals(item.Track, this)) { item.Track = null; } } } }