private void FixupCustomer(Customer previousValue) { if (previousValue != null && previousValue.Invoices.Contains(this)) { previousValue.Invoices.Remove(this); } if (Customer != null) { if (!Customer.Invoices.Contains(this)) { Customer.Invoices.Add(this); } if (CustomerId != Customer.CustomerId) { CustomerId = Customer.CustomerId; } } }