private void ProcessFields(
            ICollection <string> rawFieldValues,
            ICollection <string> fieldLabels,
            ICollection <string> fieldValues,
            int count,
            bool needsRawValues,
            bool needsLabels,
            IReadOnlyList <UPContainerFieldMetaInfo> resultFieldMap,
            UPCRMResultRow row)
        {
            var nextIndex = 1;

            for (var i = 0; i < count; i++)
            {
                var fieldIndexInTableCaption = this.hasFieldMap
                    ? this.fieldMap[i].ToInt()
                    : i + 1;

                while (nextIndex < fieldIndexInTableCaption)
                {
                    fieldValues.Add(string.Empty);
                    if (needsRawValues)
                    {
                        rawFieldValues.Add(string.Empty);
                    }

                    ++nextIndex;
                }

                string val, rawValue = null;
                if (resultFieldMap != null)
                {
                    var fieldMetaInfo = resultFieldMap[i];
                    if (fieldMetaInfo != null)
                    {
                        val = row.ValueForField(fieldMetaInfo);
                        if (needsRawValues)
                        {
                            rawValue = row.RawValueForField(fieldMetaInfo);
                        }

                        if (needsLabels)
                        {
                            var fieldLabel = fieldMetaInfo.CrmField?.Label;
                            fieldLabels.Add(fieldLabel ?? string.Empty);
                        }
                    }
                    else
                    {
                        val      = string.Empty;
                        rawValue = string.Empty;
                    }
                }
                else
                {
                    val = row.ValueAtIndex(i);
                    if (needsRawValues)
                    {
                        rawValue = row.RawValueAtIndex(i);
                    }
                }

                fieldValues.Add(val == null ? string.Empty : val.SingleLineString());

                if (needsRawValues)
                {
                    rawFieldValues.Add(rawValue ?? string.Empty);
                }

                ++nextIndex;
            }
        }