private void FillCityCodes() { int i = 0; foreach (var item in this.Provinces) { item.ProvinceId = Provinces.IndexOf(item) + 1; item.Cities.ForEach(a => a.ProvinceId = item.ProvinceId); item.Cities.ForEach(a => a.CityId = ++i); } }