public List <CallCreditDataNocs> GetNocs(CT_outputapplicant request)
        {
            var Notices = new List <CallCreditDataNocs>();

            TryRead(() => {
                foreach (var NoC in request.nocs)
                {
                    var notices = new CallCreditDataNocs();

                    var nocs = NoC;

                    TryRead(() => notices.NoticeType = nocs.type, "Notice Type (Correction or Dispute)", false);
                    TryRead(() => notices.Refnum     = nocs.refnum, "Notice Type (Notice Reference Number)", false);
                    notices.DateRaised                          = TryReadDate(() => nocs.dateraised, "Date that the Notice was raised)", false);
                    TryRead(() => notices.Text                  = nocs.text, "Text for Notice of Correction", false);
                    TryRead(() => notices.NameDetails           = nocs.name, "Name details as provided on the Notice of Correction)", false);
                    TryRead(() => notices.CurrentAddress        = Convert.ToBoolean(nocs.address.current), "Current address check", false);
                    TryRead(() => notices.UnDeclaredAddressType = (int)nocs.address.undeclaredaddresstype, "Type of undeclared address", false);
                    TryRead(() => notices.AddressValue          = nocs.address.Value, "Address value related to an applicant", false);
                    Notices.Add(notices);
                }
            }, "Notices");

            return(Notices);
        }
        public List <CallCreditDataRtr> GetRtr(CT_outputapplicant applicant)
        {
            var Rtr = new List <CallCreditDataRtr>();

            TryRead(() => {
                foreach (var RtR in applicant.rtr)
                {
                    var rtr = new CallCreditDataRtr {
                        RtrNocs = new List <CallCreditDataRtrNocs>()
                    };

                    var rtreport = RtR;
                    TryRead(() => rtr.HolderName = rtreport.holder.name, "Account holder's name", false);
                    rtr.Dob = TryReadDate(() => rtreport.holder.dob, "Account holder's date of birth", false);
                    TryRead(() => rtr.CurrentAddress        = Convert.ToBoolean(rtreport.holder.address.current), "Current address check", false);
                    TryRead(() => rtr.UnDeclaredAddressType = (int)rtreport.holder.address.undeclaredaddresstype, "Type of undeclared address", false);
                    TryRead(() => rtr.AddressValue          = rtreport.holder.address.Value, "Address value related to account holder", false);
                    TryRead(() => rtr.Updated     = rtreport.updated, "The time stamp of publication", false);
                    TryRead(() => rtr.OrgTypeCode = rtreport.orgtypecode, "Organisation type code", false);
                    TryRead(() => rtr.OrgName     = rtreport.orgname, "Organisation name", false);
                    TryRead(() => rtr.AccNum      = rtreport.accnum, "Account number", false);
                    TryRead(() => rtr.AccSuffix   = Convert.ToString(rtreport.accsuffix), "Account suffix", false);
                    TryRead(() => rtr.AccTypeCode = rtreport.acctypecode, "Account type code", false);
                    TryRead(() => rtr.Balance     = rtreport.balance, "Current balance on account ", false);
                    TryRead(() => rtr.Limit       = rtreport.limit, "Current credit limit on account ", false);
                    rtr.StartDate = TryReadDate(() => rtreport.startdate, "Account start date", false);
                    rtr.EndDate   = TryReadDate(() => rtreport.enddate, "Account closed date", false);
                    TryRead(() => rtr.AccStatusCode = rtreport.accstatuscode, "Account status code", false);
                    TryRead(() => rtr.RepayFreqCode = rtreport.repayfreqcode, "Repayment frequency code", false);
                    TryRead(() => rtr.NumOverdue    = (int)rtreport.numoverdue, "Number of overdue payments", false);
                    TryRead(() => rtr.Rollover      = Convert.ToBoolean(rtreport.rollover), "Account is rolled over check", false);
                    TryRead(() => rtr.CrediText     = Convert.ToBoolean(rtreport.creditext), "Credit extension check", false);
                    TryRead(() => rtr.ChangePay     = Convert.ToBoolean(rtreport.changepay), "Change to payment terms check", false);
                    TryRead(() => rtr.NextPayAmount = rtreport.nextpayamount, "Value of next payment due", false);
                    TryRead(() => {
                        foreach (var JudgNoc in rtreport.notice)
                        {
                            var rtrnoc = new CallCreditDataRtrNocs();

                            var rtrnotice = JudgNoc;
                            TryRead(() => rtrnoc.NoticeType = rtrnotice.type, "Notice Type (Correction or Dispute)", false);
                            TryRead(() => rtrnoc.Refnum     = rtrnotice.refnum, "Notice Type (Notice Reference Number)", false);
                            rtrnoc.DateRaised                          = TryReadDate(() => rtrnotice.dateraised, "Date that the Notice was raised)", false);
                            TryRead(() => rtrnoc.Text                  = rtrnotice.text, "Text for Notice of Correction", false);
                            TryRead(() => rtrnoc.NameDetails           = rtrnotice.name, "Name details as provided on the Notice of Correction)", false);
                            TryRead(() => rtrnoc.CurrentAddress        = Convert.ToBoolean(rtrnotice.address.current), "Current address check", false);
                            TryRead(() => rtrnoc.UnDeclaredAddressType = (int)rtrnotice.address.undeclaredaddresstype, "Type of undeclared address", false);
                            TryRead(() => rtrnoc.AddressValue          = rtrnotice.address.Value, "Address value related to real time report", false);
                            rtr.RtrNocs.Add(rtrnoc);
                        }
                    }, "Real time report Notices");

                    Rtr.Add(rtr);
                }
            }, "Real time report(MODA)");

            return(Rtr);
        }
        public List <CallCreditDataJudgments> GetJudgments(CT_outputapplicant applicant)
        {
            var Judgments = new List <CallCreditDataJudgments>();

            TryRead(() => {
                foreach (var Judg in applicant.judgments)
                {
                    var judgment = new CallCreditDataJudgments {
                        JudgmentNocs = new List <CallCreditDataJudgmentsNocs>()
                    };

                    var judgs = Judg;
                    TryRead(() => judgment.NameDetails = judgs.name, "Name details as provided on the Judgment", false);
                    judgment.Dob = TryReadDate(() => judgs.dob, "Date of birth as provided on the Judgment", false);
                    TryRead(() => judgment.CourtName             = judgs.courtname, "Court name", false);
                    TryRead(() => judgment.CourtType             = (int)judgs.courttype, "Court type", false);
                    TryRead(() => judgment.CaseNumber            = judgs.casenumber, "Case number", false);
                    TryRead(() => judgment.Status                = judgs.status, "Status of Judgment", false);
                    TryRead(() => judgment.Amount                = (int)judgs.amount, "Total amount of the Judgment", false);
                    judgment.JudgmentDate                        = TryReadDate(() => judgs.judgmentdate, "Date of the Judgment", false);
                    judgment.DateSatisfied                       = TryReadDate(() => judgs.datesatisfied, "Date that the Judgment was satisfied", false);
                    TryRead(() => judgment.CurrentAddress        = Convert.ToBoolean(judgs.address.current), "Current address check", false);
                    TryRead(() => judgment.UnDeclaredAddressType = (int)judgs.address.undeclaredaddresstype, "Type of undeclared address", false);
                    TryRead(() => judgment.AddressValue          = judgs.address.Value, "Address value related to judgment", false);
                    TryRead(() => {
                        foreach (var JudgNoc in judgs.notice)
                        {
                            var judgmentnoc = new CallCreditDataJudgmentsNocs();

                            var judgnotice = JudgNoc;
                            TryRead(() => judgmentnoc.NoticeType = judgnotice.type, "Notice Type (Correction or Dispute)", false);
                            TryRead(() => judgmentnoc.RefNum     = judgnotice.refnum, "Notice Type (Notice Reference Number )", false);
                            judgmentnoc.DateRaised                          = TryReadDate(() => judgnotice.dateraised, "Date that the Notice was raised)", false);
                            TryRead(() => judgmentnoc.Text                  = judgnotice.text, "Text for Notice of Correction", false);
                            TryRead(() => judgmentnoc.NameDetails           = judgnotice.name, "Name details as provided on the Notice of Correction)", false);
                            TryRead(() => judgmentnoc.CurrentAddress        = Convert.ToBoolean(judgnotice.address.current), "Current address check", false);
                            TryRead(() => judgmentnoc.UnDeclaredAddressType = (int)judgnotice.address.undeclaredaddresstype, "Type of undeclared address", false);
                            TryRead(() => judgmentnoc.AddressValue          = judgnotice.address.Value, "Address value related to judgment notice", false);
                            judgment.JudgmentNocs.Add(judgmentnoc);
                        }
                    }, "Judgment Notices");

                    Judgments.Add(judgment);
                }
            }, "Judgments");

            return(Judgments);
        }
        public List <CallCreditDataAssociateLinks> GetAssociateLinks(CT_outputapplicant applicant)
        {
            var AssociateLinks = new List <CallCreditDataAssociateLinks>();

            TryRead(() => {
                foreach (var AsL in applicant.associatelinks)
                {
                    var associatelink = new CallCreditDataAssociateLinks {
                        AssociateLinkNocs = new List <CallCreditDataAssociateLinksNocs>()
                    };

                    var asslinks = AsL;
                    TryRead(() => associatelink.DeclaredAddress = Convert.ToBoolean(asslinks.declaredaddress), "Declared address associate check", false);
                    TryRead(() => associatelink.OiaID           = (int)asslinks.oiaid, "pointer between an applicant's Associate Link and the corresponding opt-in associate report", false);
                    TryRead(() => associatelink.NavLinkID       = asslinks.navlinkid, "Identifier for Associate Link Navigation", false);
                    TryRead(() => associatelink.AssociateName   = asslinks.name, "Name of the associate", false);
                    associatelink.CreationDate = TryReadDate(() => asslinks.creationdate, "Date the Associate Link was created", false);
                    associatelink.LastConfDate = TryReadDate(() => asslinks.lastconfdate, "Most recent date the Associate Link was confirmed", false);
                    TryRead(() => associatelink.SupplierName     = asslinks.supplierdetails.suppliername, "Associate Link Supplier name", false);
                    TryRead(() => associatelink.SupplierTypeCode = asslinks.supplierdetails.suppliertypecode, "Associate Link Supplier type code", false);
                    TryRead(() => {
                        foreach (var AssLinkNoc in asslinks.notice)
                        {
                            var associatelinknoc = new CallCreditDataAssociateLinksNocs();

                            var asslinknotice = AssLinkNoc;
                            TryRead(() => associatelinknoc.NoticeType = asslinknotice.type, "Notice Type (Correction or Dispute)", false);
                            TryRead(() => associatelinknoc.RefNum     = asslinknotice.refnum, "Notice Type (Notice Reference Number)", false);
                            associatelinknoc.DateRaised                          = TryReadDate(() => asslinknotice.dateraised, "Date that the Notice was raised)", false);
                            TryRead(() => associatelinknoc.Text                  = asslinknotice.text, "Text for Notice of Correction", false);
                            TryRead(() => associatelinknoc.NameDetails           = asslinknotice.name, "Name details as provided on the Notice of Correction)", false);
                            TryRead(() => associatelinknoc.CurrentAddress        = Convert.ToBoolean(asslinknotice.address.current), "Current address check", false);
                            TryRead(() => associatelinknoc.UnDeclaredAddressType = (int)asslinknotice.address.undeclaredaddresstype, "Type of undeclared address", false);
                            TryRead(() => associatelinknoc.AddressValue          = asslinknotice.address.Value, "Address value related to notice against associate link", false);
                            associatelink.AssociateLinkNocs.Add(associatelinknoc);
                        }
                    }, "Associate link Notices");

                    AssociateLinks.Add(associatelink);
                }
            }, "Associate links");

            return(AssociateLinks);
        }
        public List <CallCreditDataAliasLinks> GetAliasLinks(CT_outputapplicant applicant)
        {
            var AliasLinks = new List <CallCreditDataAliasLinks>();

            TryRead(() => {
                foreach (var AlL in applicant.aliaslinks)
                {
                    var aliaslink = new CallCreditDataAliasLinks {
                        AliasLinkNocs = new List <CallCreditDataAliasLinksNocs>()
                    };

                    var alslinks = AlL;
                    TryRead(() => aliaslink.Declared         = Convert.ToBoolean(alslinks.declared), "alias was declared on input check", false);
                    TryRead(() => aliaslink.NameBefore       = alslinks.name, "Name before Alias Link", false);
                    TryRead(() => aliaslink.Alias            = alslinks.alias, "Name after Alias Link", false);
                    aliaslink.CreationDate                   = TryReadDate(() => alslinks.creationdate, "Date the Alias Link was created", false);
                    aliaslink.LastConfDate                   = TryReadDate(() => alslinks.lastconfdate, "Most recent date that the Alias Link was confirmed", false);
                    TryRead(() => aliaslink.SupplierName     = alslinks.supplierdetails.suppliername, "Alias Link Supplier name", false);
                    TryRead(() => aliaslink.SupplierTypeCode = alslinks.supplierdetails.suppliertypecode, "Alias Link Supplier type code", false);
                    TryRead(() => {
                        foreach (var AlsLinkNoc in alslinks.notice)
                        {
                            var aliaslinknoc = new CallCreditDataAliasLinksNocs();

                            var alslinknotice = AlsLinkNoc;
                            TryRead(() => aliaslinknoc.NoticeType = alslinknotice.type, "Notice Type (Correction or Dispute)", false);
                            TryRead(() => aliaslinknoc.RefNum     = alslinknotice.refnum, "Notice Type (Notice Reference Number)", false);
                            aliaslinknoc.DateRaised                          = TryReadDate(() => alslinknotice.dateraised, "Date that the Notice was raised)", false);
                            TryRead(() => aliaslinknoc.Text                  = alslinknotice.text, "Text for Notice of Correction", false);
                            TryRead(() => aliaslinknoc.NameDetails           = alslinknotice.name, "Name details as provided on the Notice of Correction)", false);
                            TryRead(() => aliaslinknoc.CurrentAddress        = Convert.ToBoolean(alslinknotice.address.current), "Current address check", false);
                            TryRead(() => aliaslinknoc.UnDeclaredAddressType = (int)alslinknotice.address.undeclaredaddresstype, "Type of undeclared address", false);
                            TryRead(() => aliaslinknoc.AddressValue          = alslinknotice.address.Value, "Address value related to notice against alias link", false);
                            aliaslink.AliasLinkNocs.Add(aliaslinknoc);
                        }
                    }, "Alias link Notices");

                    AliasLinks.Add(aliaslink);
                }
            }, "Alias links");

            return(AliasLinks);
        }
        public List <CallCreditDataSearches> GetSearches(CT_outputapplicant request)
        {
            var Searches = new List <CallCreditDataSearches>();

            TryRead(() => {
                foreach (var SrCh in request.searches)
                {
                    var searches = new CallCreditDataSearches();

                    var search = SrCh;

                    TryRead(() => searches.SearchRef         = search.searchref, "Unique Search reference identifier", false);
                    TryRead(() => searches.SearchOrgType     = search.searchorgtype, "Type of organisation carrying out the Search", false);
                    TryRead(() => searches.SearchOrgName     = search.searchorgname, "Name of (own only) organisation carrying out the Search", false);
                    TryRead(() => searches.YourReference     = search.yourreference, "Your reference supplied on the Search (own organisations only)", false);
                    TryRead(() => searches.SearchUnitName    = search.searchunitname, "Name of organisational unit carrying out the Search (own organisations only)", false);
                    TryRead(() => searches.OwnSearch         = Convert.ToBoolean(search.ownsearch), "User's own organisation check", false);
                    TryRead(() => searches.SubsequentEnquiry = Convert.ToBoolean(search.subsequentenquiry), "Subsequent enquiry check", false);
                    TryRead(() => searches.UserName          = search.username, "Username of user carrying out the Search (own organisations only)", false);
                    TryRead(() => searches.SearchPurpose     = search.searchpurpose, "Search purpose", false);
                    TryRead(() => searches.CreditType        = search.credittype, "Credit type", false);
                    TryRead(() => searches.Balance           = (int)search.balance, "Balance or credit limit applied for", false);
                    TryRead(() => searches.Term             = (int)search.term, "Term of loan applied for", false);
                    TryRead(() => searches.JointApplication = Convert.ToBoolean(search.jointapplication), "This search was a joint application check", false);
                    searches.SearchDate = TryReadDate(() => search.searchdate, "Date of Search", false);
                    TryRead(() => searches.NameDetailes = search.name, "Name details input for this Search", false);
                    searches.Dob       = TryReadDate(() => search.dob, "Applicant's date of birth", false);
                    searches.StartDate = TryReadDate(() => search.startdate, "Move in date specified for this Search", false);
                    searches.EndDate   = TryReadDate(() => search.enddate, "Move out date specified for this Search", false);
                    TryRead(() => searches.TpOptOut              = Convert.ToBoolean(search.tpoptout), "Third party data is opted out check", false);
                    TryRead(() => searches.Transient             = Convert.ToBoolean(search.transient), "Transient association check", false);
                    TryRead(() => searches.LinkType              = search.linktype, "Link Report Type (Non, Address, Associate)", false);
                    TryRead(() => searches.CurrentAddress        = Convert.ToBoolean(search.address.current), "Current address check", false);
                    TryRead(() => searches.UnDeclaredAddressType = (int)search.address.undeclaredaddresstype, "Type of undeclared address", false);
                    TryRead(() => searches.AddressValue          = search.address.Value, "Address value related to specific search", false);
                    Searches.Add(searches);
                }
            }, "Searches");

            return(Searches);
        }
        public List <CallCreditDataCreditScores> GetCreditScores(CT_outputapplicant request)
        {
            var CreditScores = new List <CallCreditDataCreditScores>();

            TryRead(() => {
                foreach (var CrSc in request.creditscores)
                {
                    var creditscores = new CallCreditDataCreditScores();

                    var credscore = CrSc;

                    TryRead(() => creditscores.score      = (int)credscore.score.Value, "Score value");
                    TryRead(() => creditscores.ScoreClass = (int)credscore.score.@class, "Class of scorecard used", false);
                    TryRead(() => creditscores.Reason1    = (int)credscore.reasons[0], "reason 1 code for the credit score", false);
                    TryRead(() => creditscores.Reason2    = (int)credscore.reasons[1], "reason 2 code for the credit score", false);
                    TryRead(() => creditscores.Reason3    = (int)credscore.reasons[2], "reason 3 code for the credit score", false);
                    TryRead(() => creditscores.Reason4    = (int)credscore.reasons[3], "reason 4 code for the credit score", false);
                    CreditScores.Add(creditscores);
                }
            }, "Credit scores");

            return(CreditScores);
        }
        public List <CallCreditDataAccs> GetAccs(CT_outputapplicant applicant, int oiaid)
        {
            var Accounts = new List <CallCreditDataAccs>();

            TryRead(() => {
                foreach (var Ac in applicant.accs)
                {
                    var account = new CallCreditDataAccs {
                        AccNocs    = new List <CallCreditDataAccsNocs>(),
                        AccHistory = new List <CallCreditDataAccsHistory>(),
                        OiaID      = oiaid
                    };

                    var acc = Ac;
                    //account holder details
                    TryRead(() => account.AccHolderName = acc.accholderdetails.name, "Account holder’s name details");
                    account.Dob = TryReadDate(() => acc.accholderdetails.dob, "Account holder’s date of birth", false);
                    TryRead(() => account.StatusCode = acc.accholderdetails.statuscode, "Account holder status code");
                    account.StartDate = TryReadDate(() => acc.accholderdetails.startdate, "account holder start day", false);
                    account.EndDate   = TryReadDate(() => acc.accholderdetails.enddate, "account holder end day", false);
                    //account holder address
                    TryRead(() => account.CurrentAddress        = Convert.ToBoolean(acc.accholderdetails.address.current), "account holder current address check", false);
                    TryRead(() => account.UnDeclaredAddressType = (int)acc.accholderdetails.address.undeclaredaddresstype, "type of undeclared address for account holder", false);
                    TryRead(() => account.AddressValue          = acc.accholderdetails.address.Value, "account holder address value");
                    //account default related details
                    account.DefDate = TryReadDate(() => [email protected], "Default date", false);
                    TryRead(() => account.OrigDefBal = [email protected], "Original default balance", false);
                    TryRead(() => account.TermBal    = [email protected], "Termination balance", false);
                    account.DefSatDate = TryReadDate(() => [email protected], "Default satisfaction date", false);
                    account.RepoDate   = TryReadDate(() => [email protected], "Repossession date", false);
                    //account delinquency related details
                    account.DelinqDate = TryReadDate(() => acc.delinquent.delinqdate, "Delinquency date", false);
                    TryRead(() => account.DelinqBal = acc.delinquent.delinqbal, "Delinquency balance", false);
                    //general account details
                    TryRead(() => account.AccNo          = acc.accdetails.accno, "Account number (own data only)");
                    TryRead(() => account.AccSuffix      = (int)acc.accdetails.accsuffix, "Account suffix code (own data only)", false);
                    TryRead(() => account.Joint          = acc.accdetails.joint, "Joint account indicator", false);
                    TryRead(() => account.Status         = acc.accdetails.status, "Status of account");
                    account.DateUpdated                  = TryReadDate(() => acc.accdetails.dateupdated, "Date that account was last updated", false);
                    TryRead(() => account.AccTypeCode    = acc.accdetails.acctypecode, "Account type code", false);
                    TryRead(() => account.AccGroupId     = (int)acc.accdetails.accgroupid, "Account Type Group Identifier", false);
                    TryRead(() => account.CurrencyCode   = acc.accdetails.currencycode, "Currency code");
                    TryRead(() => account.Balance        = acc.accdetails.balance, "Current balance on account", false);
                    TryRead(() => account.CurCreditLimit = acc.accdetails.limit, "Current credit limit on account", false);
                    TryRead(() => account.OpenBalance    = acc.accdetails.openbalance, "Account opening balance", false);
                    account.ArrStartDate                 = TryReadDate(() => acc.accdetails.arrstartdate, "Arrangement start date", false);
                    account.ArrEndDate                     = TryReadDate(() => acc.accdetails.arrenddate, "Arrangement end date", false);
                    account.PayStartDate                   = TryReadDate(() => acc.accdetails.paystartdate, "Payment start date", false);
                    account.accStartDate                   = TryReadDate(() => acc.accdetails.accstartdate, "Account start date", false);
                    account.AccEndDate                     = TryReadDate(() => acc.accdetails.accenddate, "Account end date", false);
                    TryRead(() => account.RegPayment       = acc.accdetails.regpayment, "Regular payment value", false);
                    TryRead(() => account.ExpectedPayment  = acc.accdetails.expectedpayment, "Expected payment value", false);
                    TryRead(() => account.ActualPayment    = acc.accdetails.actualpayment, "Actual payment value", false);
                    TryRead(() => account.RepayPeriod      = (int)acc.accdetails.repayperiod, "Repayment period", false);
                    TryRead(() => account.RepayFreqCode    = acc.accdetails.repayfreqcode, "Repayment frequency code", false);
                    TryRead(() => account.LumpPayment      = acc.accdetails.lumppayment, "Lump or balloon payment", false);
                    TryRead(() => account.PenIntAmt        = acc.accdetails.penintamt, "Penalty interest amount", false);
                    TryRead(() => account.PromotionalRate  = Convert.ToBoolean(acc.accdetails.promotionalrate), "Promotional rate check", false);
                    TryRead(() => account.MinimumPayment   = Convert.ToBoolean(acc.accdetails.minimumpayment), "Check for minimum payment has been made within accepted tolerances", false);
                    TryRead(() => account.StatementBalance = acc.accdetails.statementbalance, "The balance at the statement date", false);
                    //account supplier details
                    TryRead(() => account.SupplierName     = acc.supplierdetails.suppliername, "Supplier name", false);
                    TryRead(() => account.SupplierTypeCode = acc.supplierdetails.suppliertypecode, "Supplier type code", false);
                    TryRead(() => account.Apacs            = Convert.ToBoolean(acc.supplierdetails.apacs), " Check for data supplier has supplied Behavioral Data", false);

                    TryRead(() => {
                        foreach (var AcHis in acc.acchistory)
                        {
                            var AccHist = new CallCreditDataAccsHistory();

                            var acchistory                     = AcHis;
                            AccHist.M                          = TryReadDate(() => new DateTime(Convert.ToInt32(acchistory.m.Substring(0, 4)), Convert.ToInt32(acchistory.m.Substring(5)), 1, 0, 0, 0, DateTimeKind.Utc), "Year and month that history record applies to");
                            TryRead(() => AccHist.Bal          = acchistory.bal, "Balance amount for account history record");
                            TryRead(() => AccHist.CreditLimit  = acchistory.limit, "Credit limit for account history record", false);
                            TryRead(() => AccHist.Acc          = acchistory.acc, "Account status code for account history record", false);
                            TryRead(() => AccHist.Pay          = acchistory.pay, "Payment status code for account history record", false);
                            TryRead(() => AccHist.StmtBal      = acchistory.stmtbal, "Statement balance for account history record ", false);
                            TryRead(() => AccHist.PayAmt       = acchistory.payamt, "Payment amount for account history record", false);
                            TryRead(() => AccHist.CashAdvCount = acchistory.cashadvcount, "Number of cash advances for account history record", false);
                            TryRead(() => AccHist.CashAdvTotal = (int)acchistory.cashadvtotal, "Total value of cash advances for account history record ", false);
                            account.AccHistory.Add(AccHist);
                        }
                    }, "Account history");

                    TryRead(() => {
                        foreach (var AcN in acc.notice)
                        {
                            var AccNoc    = new CallCreditDataAccsNocs();
                            var accnotice = AcN;
                            TryRead(() => AccNoc.NoticeType = accnotice.type, "Notice Type (Correction or Dispute)", false);
                            TryRead(() => AccNoc.RefNum     = accnotice.refnum, "Notice Type (Notice Reference Number)", false);
                            AccNoc.DateRaised                          = TryReadDate(() => accnotice.dateraised, "Date that the Notice was raised)", false);
                            TryRead(() => AccNoc.Text                  = accnotice.text, "Text for Notice of Correction", false);
                            TryRead(() => AccNoc.NameDetails           = accnotice.name, "Name details as provided on the Notice of Correction)", false);
                            TryRead(() => AccNoc.CurrentAddress        = Convert.ToBoolean(accnotice.address.current), "current address check", false);
                            TryRead(() => AccNoc.UnDeclaredAddressType = (int)accnotice.address.undeclaredaddresstype, "type of undeclared address", false);
                            TryRead(() => AccNoc.AddressValue          = accnotice.address.Value, "Address value related to notice against account", false);
                            account.AccNocs.Add(AccNoc);
                        }
                    }, "Account notices");
                    Accounts.Add(account);
                }
            }, "Accs");

            return(Accounts);
        }
        public List <CallCreditDataAddressConfs> GetAddressConfs(CT_outputapplicant applicant)
        {
            var AddressConfs = new List <CallCreditDataAddressConfs>();

            TryRead(() => {
                foreach (var AdCnf in applicant.addressconfs)
                {
                    var conf = new CallCreditDataAddressConfs {
                        Residents = new List <CallCreditDataAddressConfsResidents>()
                    };

                    var addconfs = AdCnf;
                    TryRead(() => conf.PafValid              = Convert.ToBoolean(addconfs.pafvalid), "Postcode Address File validation check", false);
                    TryRead(() => conf.OtherResidents        = Convert.ToBoolean(addconfs.otherresidents), "Other residents flag (provided on LSAR only)", false);
                    TryRead(() => conf.CurrentAddress        = Convert.ToBoolean(addconfs.address.current), "applicant’s/associate's current address check");
                    TryRead(() => conf.UnDeclaredAddressType = (int)addconfs.address.undeclaredaddresstype, "type of undeclared address", false);
                    TryRead(() => conf.AddressValue          = addconfs.address.Value, "Address value to be confirmed");
                    TryRead(() => {
                        foreach (var Rsd in addconfs.resident)
                        {
                            var resident = new CallCreditDataAddressConfsResidents {
                                ErHistory    = new List <CallCreditDataAddressConfsResidentsErHistory>(),
                                ResidentNocs = new List <CallCreditDataAddressConfsResidentsNocs>()
                            };
                            var resids = Rsd;

                            TryRead(() => resident.MatchType     = resids.matchtype, "resident is individual match indicator", false);
                            TryRead(() => resident.CurrentName   = Convert.ToBoolean(resids.currentname), "resident's current name check", false);
                            TryRead(() => resident.DeclaredAlias = Convert.ToBoolean(resids.declaredalias), "resident's declared alias check", false);
                            TryRead(() => resident.NameDetails   = resids.name, "Confirmation of individual's details", false);
                            TryRead(() => resident.Duration      = resids.duration, "Effective duration of residency", false);
                            resident.StartDate             = TryReadDate(() => resids.startdate, "Effective start date of residency", false);
                            resident.EndDate               = TryReadDate(() => resids.enddate, "Effective end date of residency", false);
                            TryRead(() => resident.ErValid = (int)resids.ervalid, "Electoral Roll validation identifier", false);
                            TryRead(() => {
                                foreach (var ErHis in resids.erhistory)
                                {
                                    var erhistory = new CallCreditDataAddressConfsResidentsErHistory {
                                        ErHistoryNocs = new List <CallCreditDataAddressConfsResidentsErHistoryNocs>()
                                    };

                                    var erhist                          = ErHis;
                                    erhistory.StartDate                 = TryReadDate(() => erhist.startdate, "", false);
                                    erhistory.EndDate                   = TryReadDate(() => erhist.enddate, "", false);
                                    TryRead(() => erhistory.Optout      = Convert.ToBoolean(erhist.optout), "", false);
                                    TryRead(() => erhistory.RollingRoll = Convert.ToBoolean(erhist.rollingroll), "", false);
                                    TryRead(() => {
                                        foreach (var ErHisNoc in erhist.notice)
                                        {
                                            var erhnoc = new CallCreditDataAddressConfsResidentsErHistoryNocs();

                                            var erhisnotice = ErHisNoc;
                                            TryRead(() => erhnoc.NoticeType = erhisnotice.type, "Notice Type (Correction or Dispute)", false);
                                            TryRead(() => erhnoc.RefNum     = erhisnotice.refnum, "Notice Type (Notice Reference Number)", false);
                                            erhnoc.DateRaised                          = TryReadDate(() => erhisnotice.dateraised, "Date that the Notice was raised)", false);
                                            TryRead(() => erhnoc.Text                  = erhisnotice.text, "Text for Notice of Correction", false);
                                            TryRead(() => erhnoc.NameDetails           = erhisnotice.name, "Name details as provided on the Notice of Correction)", false);
                                            TryRead(() => erhnoc.CurrentAddress        = Convert.ToBoolean(erhisnotice.address.current), "current address check", false);
                                            TryRead(() => erhnoc.UnDeclaredAddressType = (int)erhisnotice.address.undeclaredaddresstype, "type of undeclared address", false);
                                            TryRead(() => erhnoc.AddressValue          = erhisnotice.address.Value, "Address value related to notice against a period of Electoral Roll history", false);
                                            erhistory.ErHistoryNocs.Add(erhnoc);
                                        }
                                    }, "Erhistory Notices");

                                    resident.ErHistory.Add(erhistory);
                                }
                            }, "Erhistory");

                            TryRead(() => {
                                foreach (var ResNoc in resids.notice)
                                {
                                    var resnoc = new CallCreditDataAddressConfsResidentsNocs();

                                    var resnotice = ResNoc;
                                    TryRead(() => resnoc.NoticeType = resnotice.type, "Notice Type (Correction or Dispute)", false);
                                    TryRead(() => resnoc.RefNum     = resnotice.refnum, "Notice Type (Notice Reference Number)", false);
                                    resnoc.DateRaised                          = TryReadDate(() => resnotice.dateraised, "Date that the Notice was raised)", false);
                                    TryRead(() => resnoc.Text                  = resnotice.text, "Text for Notice of Correction", false);
                                    TryRead(() => resnoc.NameDetails           = resnotice.name, "Name details as provided on the Notice of Correction)", false);
                                    TryRead(() => resnoc.CurrentAddress        = Convert.ToBoolean(resnotice.address.current), "current address check", false);
                                    TryRead(() => resnoc.UnDeclaredAddressType = (int)resnotice.address.undeclaredaddresstype, "type of undeclared address", false);
                                    TryRead(() => resnoc.AddressValue          = resnotice.address.Value, "Address value related to notice against a redident", false);
                                    resident.ResidentNocs.Add(resnoc);
                                }
                            }, "Resident Notices");

                            conf.Residents.Add(resident);
                        }
                    }, "Residents");

                    AddressConfs.Add(conf);
                }
            }, "AddressConfs");

            return(AddressConfs);
        }