public void LoadCurrencies() { string filePath = Directory.GetCurrentDirectory() + @"\currencies.csv"; Assembly asm = Assembly.GetExecutingAssembly(); string file = string.Format("{0}.CurrenciesRus.csv", asm.GetName().Name); Stream fileStream = asm.GetManifestResourceStream(file); FileHelper.SaveStreamToFile(filePath, fileStream); var currencies = new List <Currency>(); using (var csvReader = new CsvTableReader(filePath)) { while (csvReader.ReadLine()) { var name = csvReader.CurrentRowValues["Name"]; // only distinct currencies if (_context.Currencies .FirstOrDefault(item => item.Name == name && item.UserId == _userId) == null) { var code = csvReader.CurrentRowValues["Code"]; var symbol = csvReader.CurrentRowValues["Symbol"]; if (string.IsNullOrEmpty(symbol)) { symbol = code; } // create new currency var currency = new Currency { Name = name, Code = code, Symbol = symbol, IsActive = csvReader.CurrentRowValues["Used"] == "+", IsMain = csvReader.CurrentRowValues["Main"] == "+", UserId = _userId }; // add to currency list _context.Currencies.Add(currency); } } } FileHelper.RemoveFile(filePath); }