partial void BeforeCopyProperties(IBillExpense other, ref bool handled) { other.CheckArgument(nameof(other)); other.Bill.CheckArgument(nameof(other.Bill)); other.Expenses.CheckArgument(nameof(other.Expenses)); other.Balances.CheckArgument(nameof(other.Balances)); handled = true; TotalExpense = other.TotalExpense; FriendPortion = other.FriendPortion; NumberOfFriends = other.NumberOfFriends; Friends = other.Friends; FriendAmounts = other.FriendAmounts; BilllEntity.CopyProperties(other.Bill); ExpenseEntities.Clear(); foreach (var item in other.Expenses) { var expense = new Expense(); expense.CopyProperties(item); ExpenseEntities.Add(expense); } BalanceEntities.Clear(); foreach (var item in other.Balances) { var balance = new Balance(); balance.CopyProperties(item); BalanceEntities.Add(balance); } }