class CompositeRrdParser {

    public RrdResult parse(CompositeResult compositeResult) throws ParserException {
        int index = 0;
        RrdResult rrdResult = new RrdResult();

        for (ModelNode step : compositeResult) {
            if (step.isFailure()) {
                throw new ParserException("Failed step 'step-" + (index + 1) + "' in composite rrd result: " + step
                        .getFailureDescription());
            }

            ModelNode stepResult = step.get(RESULT);

            if (stepResult.getType() == ModelType.LIST) {
                // multiple rrd results each with its own address
                for (ModelNode modelNode : stepResult.asList()) {
                    ModelNode result = modelNode.get(RESULT);
                    if (result.isDefined()) {
                        ResourceAddress operationAddress = operationAddress(index);
                        ResourceAddress resultAddress = new ResourceAddress(modelNode.get(ADDRESS));
                        ResourceAddress resolvedAddress = makeFqAddress(operationAddress, resultAddress);

                        new SingleRrdParser(rrdResult).parse(resolvedAddress, result);
                    }
                }

            } else {
                // a single rrd result
                ResourceAddress address = operationAddress(index);
                new SingleRrdParser(rrdResult).parse(address, stepResult);
            }
            index++;
        }

        return rrdResult;
    }

      CompositeRrdParser(Composite composite);

}