private static Transaction GenerateChildTransactionForPaymentSchedule(PaymentSchedule parentPaymentSchedule, BankRun paymentSchedulesAssociatedRun)
        {
            Transaction newChildTransaction = new Transaction();

            // Get all the same fields and copy them to the new child record:
            newChildTransaction = parentPaymentSchedule.CopyCommonFieldsTo(newChildTransaction);

            // Some fields are named different or have different states for the child vs parent, so we fix those here:
            newChildTransaction.TransactionId = Guid.NewGuid();
            newChildTransaction.StatusCode    = StatusCode.Completed;          // Completed
            newChildTransaction.TransactionPaymentScheduleId = parentPaymentSchedule.PaymentScheduleId;
            newChildTransaction.BookDate                   = DateTime.UtcNow;
            newChildTransaction.CreatedOn                  = DateTime.UtcNow;
            newChildTransaction.Amount                     = parentPaymentSchedule.RecurringAmount; // Total Header
            newChildTransaction.AmountMembership           = parentPaymentSchedule.AmountMembership;
            newChildTransaction.AmountNonReceiptable       = parentPaymentSchedule.AmountNonReceiptable;
            newChildTransaction.AmountReceipted            = parentPaymentSchedule.AmountReceipted;
            newChildTransaction.TransactionPaymentMethodId = parentPaymentSchedule.PaymentMethodId;
            newChildTransaction.DepositDate                = paymentSchedulesAssociatedRun.DateToBeProcessed;
            newChildTransaction.TransactionResult          = "Bank Run ID: " + paymentSchedulesAssociatedRun.BankRunId.ToString();
            newChildTransaction.DesignationId              = parentPaymentSchedule.DesignationId;
            newChildTransaction.AppealId                   = parentPaymentSchedule.AppealId;
            newChildTransaction.TransactionCurrencyId      = parentPaymentSchedule.TransactionCurrencyId;
            newChildTransaction.MembershipInstanceId       = parentPaymentSchedule.MembershipId;
            newChildTransaction.MembershipId               = parentPaymentSchedule.MembershipCategoryId;
            newChildTransaction.SyncDate                   = null;
            newChildTransaction.ReceivedDate               = paymentSchedulesAssociatedRun.DateToBeProcessed;

            return(newChildTransaction);
        }