code: public static List<Setting> categoriesToSettings(List<Category> categories) {
      return categories.stream()
          .map(Category::getGroups)     // get groups from categories
          .filter(Objects::nonNull)     // remove all null
          .flatMap(Collection::stream)  // recursively flatten all categories
          .map(Group::getSettings)      // get settings from groups
          .filter(Objects::nonNull)     // remove all null
          .flatMap(Collection::stream)  // recursively flatten all settings
          .collect(Collectors.toList());
    }
docs: Returns a list of all the settings which are contained in a list of {@code categories}
  recursively.