protected override FileBodyModel ReadBody(string[] file)
        {
            if (Configuration.BodyFields == null || !Configuration.BodyFields.Any())
            {
                return(null);
            }

            var bodyLines = file.Select((text, index) => new { LineText = text, LineNumber = index + 1 })
                            .Where(p =>
            {
                var initialPosition = Configuration.BodyFields["TIPO_REGISTRO"].InitialPosition;
                var length          = Configuration.BodyFields["TIPO_REGISTRO"].Length;
                return(length != null && (initialPosition != null && p.LineText.Substrings(initialPosition.Value, length.Value) == Configuration.BusinessSettings.BodyIdentification));
            })
                            .ToList();

            if (!bodyLines.Any())
            {
                throw new Exception($"Não foi encontrado nenhum registro(s) do tipo:[{Configuration.BusinessSettings.BodyIdentification}]");
            }



            var bodyModel = new FileBodyModel();

            foreach (var bodyLine in bodyLines)
            {
                var line = new LineFieldsModel()
                {
                    LineNumber = bodyLine.LineNumber
                };
                foreach (var key in Configuration.BodyFields.Keys)
                {
                    var fieldConfiguration = Configuration.BodyFields[key];

                    var fileField = new Field(ProcessType, fieldConfiguration)
                    {
                        Value = bodyLine.LineText.Substrings(fieldConfiguration.InitialPosition.Value, fieldConfiguration.Length.Value)
                    };
                    line.Fields.Add(key, fileField);
                }
                bodyModel.Content.Add(line);
            }

            if (!bodyModel.Content.Any() && bodyLines.Any())
            {
                throw new Exception($"Não foi possível converter nenhuma linha do body para o modelo.");
            }

            return(bodyModel);
        }
        private List <string> CreateBodyLines(List <CancelationModel> population)
        {
            var bodyModel  = new FileBodyModel();
            var lineNumber = 1;

            foreach (var data in population)
            {
                if (data.PolicyInsurerIdentifier.isNullOrEmpty())
                {
                    _logs.Add($"A apólice {data.PolicyIdentifier} foi listada pra cancelamento, porém não pode ser cancelada, pois não possui um número de apólice");
                    continue;
                }

                var line = new LineFieldsModel()
                {
                    LineNumber = lineNumber++
                };
                foreach (var key in Configuration.BusinessSettings.DefaultValues.Keys)
                {
                    if (Configuration.BodyFields.ContainsKey(key))
                    {
                        var fieldConfiguration = Configuration.BodyFields[key];
                        var fileField          = new Field(ProcessType, fieldConfiguration)
                        {
                            Value = Configuration.BusinessSettings.DefaultValues[key]
                        };

                        line.Fields.Add(key, fileField);
                    }
                }


                CreateField(line, EnumFileFieldsType.Body, "TIPO_REGISTRO", Configuration.BusinessSettings.BodyIdentification);
                CreateField(line, EnumFileFieldsType.Body, "REGISTRO_SEQUENCIAL", line.LineNumber.ToString());
                CreateField(line, EnumFileFieldsType.Body, "DOCUMENTO", data.PolicyInsurerIdentifier.RemoveHdiDocumentFormat());
                CreateField(line, EnumFileFieldsType.Body, "ENDOSSO");
                CreateField(line, EnumFileFieldsType.Body, "NUMERO_CONTROLE_ITURAN", data.PolicyIdentifier.ToString());
                CreateField(line, EnumFileFieldsType.Body, "CODIGO_EQUIPAMENTO");
                CreateField(line, EnumFileFieldsType.Body, "DATA_CANCELAMENTO", $"{data.CancelationDate:yyyyMMdd}");
                CreateField(line, EnumFileFieldsType.Body, "DATA_PROCESSAMENTO");
                CreateField(line, EnumFileFieldsType.Body, "STATUS_CANCELAMENTO");
                CreateField(line, EnumFileFieldsType.Body, "CODIGO_OBSERVACAO");
                CreateField(line, EnumFileFieldsType.Body, "OBSERVACAO");
                CreateField(line, EnumFileFieldsType.Body, "VALOR_PREMIO");

                if (!ValidateCustomerDocument(data))
                {
                    continue;
                }

                CreateField(line, EnumFileFieldsType.Body, "TIPO_DOCUMENTO", data.DocumentType == null
                                                ? BusinessExtensions.GetDocumentType(data.CustomerDocument)?.ToInt().ToString()
                                                : data.DocumentType?.ToInt().ToString());

                CreateField(line, EnumFileFieldsType.Body, "NR_CNPJ_CPF", data.CustomerDocument.RemoveDocumentSpecialCharacters());

                bodyModel.Content.Add(line);
            }

            var bodyContent = new List <string>();

            foreach (var line in bodyModel.Content)
            {
                var body = new StringBuilder();
                foreach (var bodyField in line.PrepareSequenceFileFields())
                {
                    body.Append(bodyField.Value);
                }

                bodyContent.Add(body.Append(Environment.NewLine).ToString());
            }

            return(bodyContent);
        }