private static void ImportAstronomers() { string jsonFile = File.ReadAllText("../../../Resources/astronomers.json"); var astronomers = JsonConvert.DeserializeObject <IEnumerable <AstronomerDto> >(jsonFile); foreach (var astronom in astronomers) { if (astronom.FirstName == null || astronom.LastName == null) { Printer.PrintError(); continue; } var astronomer = new Astronomer { FirstName = astronom.FirstName, LastName = astronom.LastName }; QueryMethods.AddAstronome(astronomer); } }