code: public static <T extends IItem & IExpandable> void selectAllSubItems(final FastAdapter adapter, T header, boolean select, boolean notifyParent, Object payload) {
          int subItems = header.getSubItems().size();
          int position = adapter.getPosition(header);
          if (header.isExpanded()) {
              for (int i = 0; i < subItems; i++) {
                  if (((IItem) header.getSubItems().get(i)).isSelectable()) {
                      SelectExtension extension = (SelectExtension) adapter.getExtension(SelectExtension.class);
                      if (extension != null) {
                          if (select) {
                              extension.select(position + i + 1);
                          } else {
                              extension.deselect(position + i + 1);
                          }
                      }
                  }
                  if (header.getSubItems().get(i) instanceof IExpandable)
                      selectAllSubItems(adapter, header, select, notifyParent, payload);
  
              }
          } else {
              for (int i = 0; i < subItems; i++) {
                  if (((IItem) header.getSubItems().get(i)).isSelectable()) {
                      ((IItem) header.getSubItems().get(i)).withSetSelected(select);
                  }
                  if (header.getSubItems().get(i) instanceof IExpandable)
                      selectAllSubItems(adapter, header, select, notifyParent, payload);
              }
          }
  
          // we must notify the view only!
          if (notifyParent && position >= 0) {
              adapter.notifyItemChanged(position, payload);
          }
      }
docs: select or unselect all sub itmes underneath an expandable item
  
  @param adapter      the adapter instance
  @param header       the header who's children should be selected or deselected
  @param select       the new selected state of the sub items
  @param notifyParent true, if the parent should be notified about the changes of its children selection state
  @param payload      payload for the notifying function