docs: private WFSharedContext extractWFDispatcherResult(
              final DispatcherResult dispatcherResult,
              final List<StepExecutionResult> results,
              final Map<String, Collection<StepExecutionResult>> failures,
              final Map<Integer, StepExecutionResult> stepFailures,
              int index,
              int max
      )
      {
          WFSharedContext wfSharedContext = new WFSharedContext();
          ArrayList<HashMap<String, NodeStepResult>> mergedStepResults = new ArrayList<>(max);
          ArrayList<Boolean> successes = new ArrayList<>(max);
          HashMap<Integer, Map<String, NodeStepResult>> mergedStepFailures
              = new HashMap<>();
  
  
          //Convert a dispatcher result to a list of StepExecutionResults.
          //each result for node in the dispatcheresult contains a workflow result
          //unroll each workflow result, append the result of each step into map of node results
          //merge each step result with the mergedStepResults
  
          //DispatcherResult contains map {nodename: NodeStepResult}
          for (final String nodeName : dispatcherResult.getResults().keySet()) {
              final NodeStepResult stepResult = dispatcherResult.getResults().get(nodeName);
              if (stepResult.getSharedContext() != null) {
                  wfSharedContext.merge(stepResult.getSharedContext());
              }
  
              //This NodeStepResult is produced by the DispatchedWorkflow wrapper
              WorkflowExecutionResult result = DispatchedWorkflow.extractWorkflowResult(stepResult);
  
              failures.computeIfAbsent(nodeName, k -> new ArrayList<>());
  
              //extract failures for this node
              final Collection<StepExecutionResult> thisNodeFailures = result.getNodeFailures().get(nodeName);
              if (null != thisNodeFailures && thisNodeFailures.size() > 0) {
                  failures.get(nodeName).addAll(thisNodeFailures);
              }
  
              //extract failures by step (for this node)
              Map<Integer, NodeStepResult> perStepFailures = DispatchedWorkflow.extractStepFailures(result,
                                                                                                    stepResult.getNode());
              for (final Map.Entry<Integer, NodeStepResult> entry : perStepFailures.entrySet()) {
                  Integer stepNum = entry.getKey();
                  NodeStepResult value = entry.getValue();
                  mergedStepFailures.computeIfAbsent(stepNum, k -> new HashMap<>());
                  mergedStepFailures.get(stepNum).put(nodeName, value);
              }
              if (result.getResultSet().size() < 1 && result.getNodeFailures().size() < 1 && result.getStepFailures()
                      .size() < 1 && !result.isSuccess()) {
  
                  //failure could be prior to any node step
  
                  mergedStepFailures.computeIfAbsent(0, k -> new HashMap<>());
                  mergedStepFailures.get(0).put(nodeName, stepResult);
              }
              //The WorkflowExecutionResult has a list of StepExecutionResults produced by NodeDispatchStepExecutor
              List<NodeStepResult> results1 = DispatchedWorkflow.extractNodeStepResults(result, stepResult.getNode());
              int i = 0;
              for (final NodeStepResult nodeStepResult : results1) {
                  while (mergedStepResults.size() <= i) {
                      mergedStepResults.add(new HashMap<>());
                  }
                  while (successes.size() <= i) {
                      successes.add(Boolean.TRUE);
                  }
                  HashMap<String, NodeStepResult> map = mergedStepResults.get(i);
  
                  map.put(nodeName, nodeStepResult);
  
                  if (!nodeStepResult.isSuccess()) {
                      successes.set(i, false);
  //                    failures.get(nodeName).add(nodeStepResult);
                  }
                  i++;
              }
          }
  
          //add a new wrapped DispatcherResults for each original step
          int x = 0;
          for (final HashMap<String, NodeStepResult> map : mergedStepResults) {
              Boolean success = successes.get(x);
              DispatcherResult r = new DispatcherResultImpl(map, null != success ? success : false);
              results.add(NodeDispatchStepExecutor.wrapDispatcherResult(r));
              x++;
          }
  
          //merge failures for each step
          for (final Integer integer : mergedStepFailures.keySet()) {
              Map<String, NodeStepResult> map = mergedStepFailures.get(integer);
  
              DispatcherResult r = new DispatcherResultImpl(map, false);
              stepFailures.put(integer, NodeDispatchStepExecutor.wrapDispatcherResult(r));
          }
          return wfSharedContext;
      }