private static void selectGroups(ObjectPredicate predicate, ObjectOperation operation,
                                     Group group, int first, int last, int current) {
        if (current > last) {
            return;
        }
        if (current >= first) {
            group.select(predicate, operation);
        }
        for (Group child : group.getChildren()) {
            selectGroups(predicate, operation, child, first, last, current + 1);
        }
    }
This is a helper function to perform recursive traversal of all groups contained in this grouping object. It
is invoked by the {@link #selectMembers(ObjectPredicate, ObjectOperation)} method and itself. This method will
only evaluate the groups that belong to active levels.

@param predicate the object predicate to evaluate
@param operation the operation to execute when the predicate is true
@param group     the group to evaluate
@param first     the first active level
@param last      the last active level
@param current   the level being evaluated
searchlib/src/main/java/com/yahoo/searchlib/aggregation/Grouping.java