docs: public static void createEventScopeExecution(ExecutionEntity execution) {
  
      // parent execution is a subprocess or a miBody
      ActivityImpl activity = execution.getActivity();
      ExecutionEntity scopeExecution = (ExecutionEntity) execution.findExecutionForFlowScope(activity.getFlowScope());
  
      List<EventSubscriptionEntity> eventSubscriptions = execution.getCompensateEventSubscriptions();
  
      if (eventSubscriptions.size() > 0 || hasCompensationEventSubprocess(activity)) {
  
        ExecutionEntity eventScopeExecution = scopeExecution.createExecution();
        eventScopeExecution.setActivity(execution.getActivity());
        eventScopeExecution.activityInstanceStarting();
        eventScopeExecution.enterActivityInstance();
        eventScopeExecution.setActive(false);
        eventScopeExecution.setConcurrent(false);
        eventScopeExecution.setEventScope(true);
  
        // copy local variables to eventScopeExecution by value. This way,
        // the eventScopeExecution references a 'snapshot' of the local variables
        Map<String, Object> variables = execution.getVariablesLocal();
        for (Entry<String, Object> variable : variables.entrySet()) {
          eventScopeExecution.setVariableLocal(variable.getKey(), variable.getValue());
        }
  
        // set event subscriptions to the event scope execution:
        for (EventSubscriptionEntity eventSubscriptionEntity : eventSubscriptions) {
          EventSubscriptionEntity newSubscription =
                  EventSubscriptionEntity.createAndInsert(
                          eventScopeExecution,
                          EventType.COMPENSATE,
                          eventSubscriptionEntity.getActivity());
          newSubscription.setConfiguration(eventSubscriptionEntity.getConfiguration());
          // use the original date
          newSubscription.setCreated(eventSubscriptionEntity.getCreated());
        }
  
        // set existing event scope executions as children of new event scope execution
        // (ensuring they don't get removed when 'execution' gets removed)
        for (PvmExecutionImpl childEventScopeExecution : execution.getEventScopeExecutions()) {
          childEventScopeExecution.setParent(eventScopeExecution);
        }
  
        ActivityImpl compensationHandler = getEventScopeCompensationHandler(execution);
        EventSubscriptionEntity eventSubscription = EventSubscriptionEntity
                .createAndInsert(
                  scopeExecution,
                  EventType.COMPENSATE,
                  compensationHandler
                );
        eventSubscription.setConfiguration(eventScopeExecution.getId());
  
      }
    }