private static void ColorsSeeding() { var json = File.ReadAllText("CarColorsJsonImporterFile.json"); var properties = JsonSerializer.Deserialize <IEnumerable <ColorDto> >(json); var db = new CarDealerDbContext(); ICarsService carsService = new CarsService(db); foreach (var property in properties) { try { carsService.AddColor(property.Name); } catch { } } }