private static IActionSequence getNextLoopGroup(
      final ISequenceDefinition seqDef,
      final Node actionsNode,
      final String solutionPath,
      final String solutionName,
      final ILogger logger,
      final int loggingLevel) {

    String loopParameterName = XmlDom4JHelper.getNodeText("@loop-on", actionsNode); // $NON-NLS-1$
    boolean loopUsingPeek =
        "true"
            .equalsIgnoreCase(
                XmlDom4JHelper.getNodeText("@peek-only", actionsNode)); // $NON-NLS-1$ //$NON-NLS-2$

    Node actionDefinitionNode;
    ActionDefinition actionDefinition;

    List actionDefinitionList = new ArrayList();

    List nodeList = actionsNode.selectNodes("*"); // $NON-NLS-1$
    Iterator actionDefinitionNodes = nodeList.iterator();
    while (actionDefinitionNodes.hasNext()) {
      actionDefinitionNode = (Node) actionDefinitionNodes.next();
      if (actionDefinitionNode.getName().equals("actions")) { // $NON-NLS-1$
        actionDefinitionList.add(
            SequenceDefinition.getNextLoopGroup(
                seqDef, actionDefinitionNode, solutionPath, solutionName, logger, loggingLevel));
      } else if (actionDefinitionNode.getName().equals("action-definition")) { // $NON-NLS-1$
        actionDefinition = new ActionDefinition(actionDefinitionNode, logger);
        actionDefinition.setLoggingLevel(loggingLevel);
        actionDefinitionList.add(actionDefinition);
      }
    }
    // action sequences with 0 actions are valid, see: JIRA PLATFORM-837

    IConditionalExecution conditionalExecution =
        SequenceDefinition.parseConditionalExecution(
            actionsNode, logger, "condition"); // $NON-NLS-1$

    ActionSequence sequence =
        new ActionSequence(loopParameterName, seqDef, actionDefinitionList, loopUsingPeek);

    sequence.setConditionalExecution(conditionalExecution);
    return sequence;
  }