class SequenceDescriptorFactory {

    public SequenceDescriptor create(final Document document, final Element sequenceElement, final List<DialogDescriptor> dialogDescriptors) {
        List<ConditionDescriptor> conditionDescriptors = conditionDescriptorNodesParser.parseNodesOfElement(document, sequenceElement);
        Map<String, DialogDescriptor> dialogDescriptorMap = dialogDescriptorMapper.groupByName(dialogDescriptors);
        List<DialogDescriptor> referencedDialogDescriptors = dialogDescriptorReferenceParser.parse(sequenceElement, dialogDescriptorMap);
        SequenceDescriptorAttributes attributes = sequenceDescriptorAttributesParser.parseNode(sequenceElement, document);
        return new SequenceDescriptor(conditionDescriptors, referencedDialogDescriptors, attributes);
    }

}