public void Go()
        {
            // Process protected data
            if (string.IsNullOrEmpty(Data))
            {
                throw new ArgumentNullException();
            }

            if ((Data.Length % 2011) != 0)
            {
                throw new ArgumentException("Invalid data length");
            }

            var blockCount = Data.Length / 2011;

            for (var i = 0; i < blockCount; i += 2566)
            {
                var chunk  = Data.Substring(i, 2566);
                var record = new MTSData();

                using (var dataBlock = new FixedLengthReader(chunk))
                {
                    dataBlock.Read(record);
                    ProcessRecord(record);
                }
            }

            WriteListToGateway();
        }
        private void ProcessRecord(MTSData mtsData)
        {
            try
            {
                var mtsRecord = new MtsRecord
                {
                    Patient =
                    {
                        PatientID       = mtsData.PatientNum,
                        LastName        = mtsData.LastName,
                        FirstName       = mtsData.FirstName,
                        MiddleInitial   = mtsData.MiddleInitial,
                        Room            = mtsData.Room,
                        ResponisbleName = mtsData.RphName,
                        logRecords      = DebugMode
                    },
                    Scrip =
                    {
                        DrugID      = mtsData.OrderedItemCode,
                        RxSys_RxNum = mtsData.RXOrderNum,
                        RxStartDate = mtsData.FillStartDate,
                        Refills     = Convert.ToInt32(mtsData.RefillsRemaining ?? "0"),
                        Sig         = $"{mtsData.SigDirections}\n{mtsData.ExpandedDirections}",
                        Comments    = mtsData.DrugCautionMessages,
                        logRecords  = DebugMode
                    },
                    Facility = { LocationID = mtsData.FacilityNum },
                    Doc      =
                    {
                        LastName   = mtsData.PhysicianLastName,
                        FirstName  = mtsData.PhysicianFirstName,
                        DEA_ID     = mtsData.PhyscianDeaCode,
                        logRecords = DebugMode
                    }
                };


                //mtsRecord.Scrip.DoseTimesQtys = mtsData.MedAdminTime.ToString("HHmm") + mtsData.Dose.ToString("00");
                //mtsRecord.Scrip.QtyPerDose = mtsData.Dose.ToString();



                //
                // Apparently the system will send over a record per dose.  We'll treat the first data found as the start date
                // and carry on from there.
                //
                if (_recordList.Find(x => x.Scrip.RxSys_RxNum == mtsRecord.Scrip.RxSys_RxNum) == null)
                {
                    _recordList.Add(mtsRecord);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }