class PropertyHelper {

  public static Set<String> getCategories(Set<String> propertyIds) {
    Set<String> categories = new HashSet<>();
    for (String property : propertyIds) {
      String category = PropertyHelper.getPropertyCategory(property);
      while (category != null) {
        categories.add(category);
        category = PropertyHelper.getPropertyCategory(category);
      }
    }
    return categories;
  }

}