/* Saves data into DB */
        private async Task SaveDataToDB(string session, List <StoreItemDto> data, string filename, string newfilename)
        {
            StoreItem itemDB;
            int       index = 0;

            foreach (StoreItemDto item in data)
            {
                itemDB         = new StoreItem(item, filename, newfilename);
                itemDB.Session = session;
                await _fileRepository.InsertToDB(itemDB);

                ImportStateService.SetProgress(session, ImportState.DBImporting, CalculatePercentage(++index, data.Count));
            }
        }
        /* Saves data into json file */
        private async Task SaveDataToFile(string session, List <StoreItemDto> data, string newfilename)
        {
            ImportStateService.SetProgress(session, ImportState.DBImporting, 0);

            if (!Directory.Exists(_settings.Value.SavingDirectory))
            {
                Directory.CreateDirectory(_settings.Value.SavingDirectory);
            }

            string path = _settings.Value.SavingDirectory + newfilename;
            await File.WriteAllTextAsync(path, JsonConvert.SerializeObject(data));

            ImportStateService.SetProgress(session, ImportState.DBImporting, 100);
            _logger.LogInfo("Data is saved as a csv file : " + path);
        }