public Region CreateRegion(CreateRegionParameters param) { if (regionRepository.Any(r => r.Name == param.Name && r.CountryCoreID == param.CountryID)) { Console.WriteLine($"Region {param.Name} exists!"); return(regionRepository.Single(r => r.Name == param.Name && r.CountryCoreID == param.CountryID)); } var region = new Region() { CanSpawn = param.CanSpawn, CountryID = param.CountryID, Name = param.Name, CountryCoreID = param.CountryID }; regionRepository.Add(region); regionRepository.SaveChanges(); Console.WriteLine($"Region {param.Name} created!"); return(region); }