private int UpdateSubItemCategories(string parentId) { ItemCategoryFacade localFacade = new ItemCategoryFacade(); localFacade.DeleteItemCategoryByParentId(parentId); CategoryFacade topFacade = new CategoryFacade(varHelper.TOP_AppKey, varHelper.TOP_AppSecret); TOPDataList <ItemCategory> list = topFacade.GetItemCategories(parentId, string.Empty); foreach (ItemCategory category in list) { if (!localFacade.IsItemCategoryExist(category.Id)) { localFacade.AddItemCategory(string.Empty, category.Id, category.ParentId, category.Name, category.IsParent, category.Status, category.SortOrder); } } return(list.Count); }