public void Process(Stream pmInFile, Stream pmCmOutFile, List <CodaCode> codes)
            {
                using (StreamReader sr = new StreamReader(pmInFile))
                {
                    // xmloutputgenerator - ideally a dependency? but wth.
                    using (var xmlOutputGenerator = new XmlOutputGenerator(pmCmOutFile))
                    {
                        // //         // using (StreamWriter sw = new StreamWriter(PmCmOutFile))
                        // //          // {
                        string paymentLine;
                        int    ctr = 0;
                        while ((paymentLine = sr.ReadLine()) != null)
                        {
                            ctr++;
                            //split the line
                            string[] fields = paymentLine.Split(',');

                            //lift necessary fields from payment file record
                            string recordType = fields[0];


                            // // //valid line?
                            if ("23456".Contains(recordType))
                            {
                                string policyNumber = fields[4];


                                //get codacode from collection
                                CodaCode theCode = codes.FirstOrDefault(x => x.PolicyNumber == policyNumber);
                                if (theCode != null)
                                {
                                    //create processedPayment object

                                    paymentLine = paymentLine + "," + theCode.Coda;
                                }
                                else
                                {
                                    //no coda code found in lookup
                                    paymentLine = paymentLine + ", CODA CODE NOT FOUND";
                                }
                            }

                            //WRITE XML OUTPUT -
                            xmlOutputGenerator.WriteLine(paymentLine);

                            // _log.Info($"processed payment = {paymentLine}");
                        }
                        _log.log($"     Payment lines processed     : {ctr.ToString()}");
                    }
                }
            }
            public List <CodaCode> CodaCodes(TraceWriter log)
            {
                List <CodaCode> codes = new List <CodaCode>();

                int    id;
                string policyNumber;
                string codaCode;

                try
                {
                    //Pass the file path and file name to the StreamReader constructor
                    using (StreamReader sr = new StreamReader("C:/temp/loadCodaMappings.csv"))
                    {
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            string[] field = line.Split(',');

                            id           = Convert.ToInt32(field[0]);
                            policyNumber = field[1];
                            codaCode     = field[2];

                            CodaCode cc = new CodaCode()
                            {
                                Id = id, PolicyNumber = policyNumber, Coda = codaCode
                            };
                            codes.Add(cc);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
                //finally
                //{
                //    Console.WriteLine("Executing finally block.");
                //}


                return(codes);
            }