private static DataTable GetImportFileAsDataTable(ImportQueue queuedItem, ImportFileSettings settings)
 {
     return ExcelReader.ReadExcelAsDataTable(queuedItem.FilePath, settings);
 }
        public ImportResult ProcessImportQueue(ImportQueue queuedItem, ImportFileSettings fileSettings)
        {
            var result = new ImportResult();

            queuedItem.ImportData = GetImportFileAsDataTable(queuedItem, fileSettings);
            
            // Validate the import data with some quick sanity checks

            var validator = new ImportDataValidator();
            var validationResult = validator.Validate(queuedItem);
            if (!validationResult.IsValid)
            {
                throw new ValidationException(validationResult.Errors);
            }

            queuedItem = BulkImportDataTableToDataStore(queuedItem);
            queuedItem = ProcessImportData(queuedItem);

            //File.Delete(queuedItem.FilePath);

            result.Status = queuedItem.ImportStatus;
            result.TakeRateId = queuedItem.TakeRateId;

            return result;
        }