private bool Equals(IInvoice other) { if (!(InvoiceId == other.InvoiceId && InvoiceNumber == other.InvoiceNumber && InvoiceNumberAsString == other.InvoiceNumberAsString && Total.Equals(other.Total) && Subtotal.Equals(other.Subtotal) && Nullable.Equals(Tax, other.Tax) && Nullable.Equals(TaxPercentage, other.TaxPercentage) && InvoiceDate.Equals(other.InvoiceDate) && ContractName == other.ContractName && PeriodStartDate.Equals(other.PeriodStartDate) && PeriodEndDate.Equals(other.PeriodEndDate) && Currency == other.Currency && Equals(From, other.From) && Equals(To, other.To))) { return(false); } if (LineItems is null && other.LineItems is null) { return(true); } if (LineItems is null || other.LineItems is null) { return(false); } return(LineItems.OrderBy(x => x.LineIdx).SequenceEqual(other.LineItems.OrderBy(x => x.LineIdx))); }