private static async Task SaveCountryInFile(string countryCode, IEnumerable <Country> countries, DbGeography geoBorder, StreamWriter streamWriter) { var country = countries.FirstOrDefault(c => c.CC2 == countryCode || c.CC3 == countryCode); if (country != null) { await streamWriter.WriteLineAsync($"{country.CountryId},{country.Name},{country.CC2},{country.CC3},{country.AffiliationId},{geoBorder.AsGml()}"); } }