private static void CategoriesSeeding() { var json = File.ReadAllText("CategoriesJsonImporterFile.json"); var properties = JsonSerializer.Deserialize <IEnumerable <CategoryDto> >(json); var db = new CarDealerDbContext(); ICarsService carservice = new CarsService(db); foreach (var property in properties) { try { carservice.AddCategory(property.Name); } catch { } } }