public void ReOrderThesaban() { if (_changwat != null) { foreach (PopulationDataEntry entity in _changwat.SubEntities) { if (entity != null) { if (EntityTypeHelper.Thesaban.Contains(entity.Type) | EntityTypeHelper.Sakha.Contains(entity.Type)) { _thesaban.Add(entity); } } } foreach (PopulationDataEntry thesaban in _thesaban) { _changwat.SubEntities.Remove(thesaban); } foreach (PopulationDataEntry thesaban in _thesaban) { if (thesaban.SubEntities.Any()) { foreach (PopulationDataEntry tambon in thesaban.SubEntities) { _changwat.AddTambonInThesabanToAmphoe(tambon, thesaban); } } } foreach (PopulationDataEntry entity in _changwat.SubEntities) { if (entity != null) { entity.SortSubEntitiesByGeocode(); } } } }