private static void PopulateBankAccount(Transactions transactions, Balance balance, Ofx ofx)
        {
            ofx.BANKMSGSRSV1                                      = new Bankmsgsrsv1();
            ofx.BANKMSGSRSV1.STMTTRNRS                            = new Stmttrnrs();
            ofx.BANKMSGSRSV1.STMTTRNRS.TRNUID                     = "1";
            ofx.BANKMSGSRSV1.STMTTRNRS.STATUS                     = new Status();
            ofx.BANKMSGSRSV1.STMTTRNRS.STATUS.CODE                = "0";
            ofx.BANKMSGSRSV1.STMTTRNRS.STATUS.CODE                = "INFO";
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS                     = new Stmtrs();
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.CURDEF              = transactions.CURRENCY; // GBP
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKACCTFROM        = new Bankacctfrom();
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKACCTFROM.ACCTID =
                transactions.ACCOUNT_ID; // TODO: change to bank account number
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKACCTFROM.BANKID =
                transactions.ACCOUNT_ID; // TODO:  change to sort code
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKTRANLIST         = new Banktranlist();
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKTRANLIST.DTSTART =
                transactions.START_DATE.ToString("yyyyMMdd"); //"20180611";
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKTRANLIST.DTEND =
                transactions.END_DATE.ToString("yyyyMMdd");   // "20180618";
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKTRANLIST.STMTTRN = new List <Stmttrn>();

            foreach (var transaction in transactions.Items)
            {
                var item = new Stmttrn();
                item.TRNTYPE  = transaction.TransactionType;                 // "ATM"; TODO: check this is not credit debit
                item.DTPOSTED = transaction.DatePosted.ToString("yyyyMMdd"); // "20180611";
                item.TRNAMT   = transaction.TransactionAmount;               // "-4.49";
                item.FITID    = transaction.TransactionId;                   //  "201806110002"; // date + 1 for each transaction, unique ID
                item.NAME     = transaction.Description;
                item.MEMO     = transaction.MEMO;
                ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.BANKTRANLIST.STMTTRN.Add(item);
            }

            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.LEDGERBAL        = new Ledgerbal();
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.LEDGERBAL.BALAMT = balance.AMOUNT; //"-4855.60";
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.LEDGERBAL.DTASOF = balance.AS_OF.ToString("yyyyMMdd");

            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.AVAILBAL        = new Availbal();
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.AVAILBAL.BALAMT = balance.AVAILABLE_AMOUNT; //"-4855.60";
            ofx.BANKMSGSRSV1.STMTTRNRS.STMTRS.AVAILBAL.DTASOF = balance.AVAILABLE_AS_OF.ToString("yyyyMMdd");
        }
        private static void PopulateCreditCard(Transactions transactions, Balance balance, Ofx ofx)
        {
            ofx.CREDITCARDMSGSRSV1                                        = new Creditcardmsgsrsv1();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS                            = new Ccstmttrnrs();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.TRNUID                     = "1";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.STATUS                     = new Status();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.STATUS.CODE                = "0";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.STATUS.CODE                = "INFO";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS                   = new Ccstmtrs();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.CURDEF            = transactions.CURRENCY; // GBP
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.CCACCTFROM        = new Ccacctfrom();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.CCACCTFROM.ACCTID =
                transactions.ACCOUNT_ID; // creditcardnymvers
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.BANKTRANLIST         = new Banktranlist();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.BANKTRANLIST.DTSTART =
                transactions.START_DATE.ToString("yyyyMMdd"); //"20180611";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.BANKTRANLIST.DTEND =
                transactions.END_DATE.ToString("yyyyMMdd");   // "20180618";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.BANKTRANLIST.STMTTRN = new List <Stmttrn>();

            foreach (var transaction in transactions.Items)
            {
                var item = new Stmttrn();
                item.TRNTYPE  = transaction.TransactionType;                 //"DEBIT";
                item.DTPOSTED = transaction.DatePosted.ToString("yyyyMMdd"); // "20180611";
                item.TRNAMT   = transaction.TransactionAmount;               // "-4.49";
                item.FITID    =
                    transaction.TransactionId;                               //  "201806110002"; // date + 1 for each transaction, unique ID
                item.NAME = transaction.Description;
                item.MEMO = transaction.MEMO;
                ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.BANKTRANLIST.STMTTRN.Add(item);
            }

            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.LEDGERBAL        = new Ledgerbal();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.LEDGERBAL.BALAMT = balance.AMOUNT; //"-4855.60";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.LEDGERBAL.DTASOF = balance.AS_OF.ToString("yyyyMMdd");

            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.AVAILBAL        = new Availbal();
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.AVAILBAL.BALAMT = balance.AVAILABLE_AMOUNT; //"-4855.60";
            ofx.CREDITCARDMSGSRSV1.CCSTMTTRNRS.CCSTMTRS.AVAILBAL.DTASOF =
                balance.AVAILABLE_AS_OF.ToString("yyyyMMdd");
        }