extracted CategoryController's visibility logic to updateVisibilityForAllCategories method