/// <summary>
        ///     Begin task to import spreadsheet data.
        /// </summary>
        /// <param name="importSettings">The settings of the import.</param>
        /// <returns>Returns the ID of the import run.</returns>
        public long StartImport(ImportSettings importSettings)
        {
            // Validate
            if (importSettings == null)
            {
                throw new ArgumentNullException(nameof(importSettings));
            }
            if (string.IsNullOrEmpty(importSettings.FileToken))
            {
                throw new ArgumentException("importSettings.FileToken");
            }

            // Load the config
            ImportConfig importConfig = SecurityBypassContext.ElevateIf(
                importSettings.SuppressSecurityCheckOnImportConfig,
                () => _entityRepository.Get <ImportConfig>(importSettings.ImportConfigId));

            if (importConfig == null)
            {
                throw new ArgumentException("importSettings.ImportConfigId");
            }

            // Create a new import run
            ImportRun importRun = CreateImportRunEntity(importConfig, importSettings);

            SecurityBypassContext.Elevate(importRun.Save);

            long importRunId = importRun.Id;

            try
            {
                _asyncRunner.Start(() => _importRunWorker.StartImport(importRunId));
            }
            catch
            {
                // Async operation failed to start
                // (This is not reached if the import itself fails)
                importRun.ImportRunStatus_Enum = WorkflowRunState_Enumeration.WorkflowRunFailed;
                importRun.ImportMessages       = "Failed to start importer.";
                SecurityBypassContext.Elevate(importRun.Save);
                throw;
            }

            return(importRun.Id);
        }