/// <summary>
        /// Populates the <see cref="DataRow" /> using the specified <paramref name="row" />.
        /// </summary>
        /// <param name="importContext">The import context.</param>
        /// <param name="dataRow">The data row to populate.</param>
        /// <param name="row">The imported source data row.</param>
        /// <returns>
        /// The <see cref="DataRow" /> with the populated data.
        /// </returns>
        protected virtual async Task <bool> PopulateRow(ImportProcessContext importContext, DataRow dataRow, string[] row)
        {
            try
            {
                foreach (var field in importContext.MappedFields)
                {
                    if (field.Definition.Default.HasValue)
                    {
                        dataRow[field.Definition.Name] = GetDefault(field.Definition, importContext.UserName);
                        continue;
                    }

                    var index = field.FieldMap.Index;
                    if (!index.HasValue)
                    {
                        continue;
                    }

                    var value = row[index.Value];

                    var convertValue = await ConvertValue(importContext, field.Definition, value);

                    dataRow[field.Definition.Name] = convertValue ?? DBNull.Value;
                }

                if (importContext.Definition.Validator == null)
                {
                    return(true);
                }

                var validator = importContext.GetService(importContext.Definition.Validator) as IImportValidator;
                if (validator == null)
                {
                    throw new InvalidOperationException($"Failed to create data row validator '{importContext.Definition.Validator}'");
                }

                await validator.ValidateRow(importContext.Definition, dataRow);

                return(true);
            }
            catch (Exception ex)
            {
                importContext.Errors.Add(ex);

                if (importContext.Errors.Count > importContext.Definition.MaxErrors)
                {
                    throw;
                }

                return(false);
            }
        }
        /// <summary>
        /// Converts the source string value into the correct data type using specified <paramref name="field" /> definition.
        /// </summary>
        /// <param name="importContext">The import context.</param>
        /// <param name="field">The field definition.</param>
        /// <param name="value">The source value.</param>
        /// <returns>
        /// The convert value.
        /// </returns>
        /// <exception cref="InvalidOperationException">Failed to create translator for field '{field.Name}'</exception>
        protected virtual async Task <object> ConvertValue(ImportProcessContext importContext, FieldDefinition field, string value)
        {
            if (field.Translator == null)
            {
                value.TryConvert(field.DataType, out var convertValue);
                return(convertValue);
            }

            var translator = importContext.GetService(field.Translator) as IFieldTranslator;

            if (translator == null)
            {
                throw new InvalidOperationException($"Failed to create translator for field '{field.Name}'");
            }


            var translatedValue = await translator.Translate(value);

            return(translatedValue);
        }