private void btnCategory_Click(object sender, EventArgs e) { var entityTypes = new List <EntityType>() { EntityType.Amphoe, EntityType.Thesaban, EntityType.TAO, EntityType.Tambon, EntityType.Muban, }; foreach (var entity in allEntities.Where(x => x.type == EntityType.Changwat)) { foreach (var entityType in entityTypes) { var wikiDataItem = _helper.FindThaiCategory(entity, entityType); if (wikiDataItem != null) { _helper.AddCategoryCombinesTopic(wikiDataItem, entity, entityType); _helper.AddCategoryListOf(wikiDataItem, entity, entityType); } } } }