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