class ProcessPostConverter {

    public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) {
        if (definitionResolver.getResolutionFactor() != 1) {
            context = PostConverterContext.of(rootNode, definitionResolver.isJbpm());
            adjustAllEdgeConnections(rootNode, true);
            if (context.hasCollapsedNodes()) {

                List<LaneInfo> laneInfos = new ArrayList<>();
                new ArrayList<>(rootNode.getChildren()).stream()
                        .filter(ProcessPostConverter::isLane)
                        .filter(BpmnNode::hasChildren)
                        .forEach(lane -> {
                            LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren()));
                            laneInfos.add(laneInfo);
                            laneInfo.getChildren().forEach(child -> child.setParent(rootNode));
                            rootNode.removeChild(lane);
                        });

                rootNode.getChildren().stream()
                        .filter(ProcessPostConverter::isSubProcess)
                        .forEach(this::postConvertSubProcess);

                List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode);
                resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild));

                laneInfos.forEach(laneInfo -> {
                    laneInfo.getLane().setParent(rootNode);
                    laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane()));
                    adjustLane(laneInfo.getLane(), laneInfo.getPadding());
                });
                adjustAllEdgeConnections(rootNode, false);

                return Result.success(rootNode, resizedChildren.stream()
                        .map(n -> MarshallingMessage.builder()
                                .message("Collapsed node was resized " + n.value().getContent().getDefinition())
                                .messageKey(MarshallingMessageKeys.collapsedElementExpanded)
                                .messageArguments(n.value().getUUID(),
                                                  Optional.ofNullable(n.value())
                                                          .map(Node::getContent)
                                                          .map(View::getDefinition)
                                                          .map(BPMNViewDefinition::getGeneral)
                                                          .map(BPMNBaseInfo::getName)
                                                          .map(Name::getValue)
                                                          .orElse(""))
                                .type(Violation.Type.WARNING)
                                .build())
                        .toArray(MarshallingMessage[]::new));
            }
        }
        return Result.success(rootNode);
    }

      ProcessPostConverter();

}