docs: protected int createInstances(DelegateExecution multiInstanceExecution) {
      
      int nrOfInstances = resolveNrOfInstances(multiInstanceExecution);
      if (nrOfInstances == 0) {
        return nrOfInstances;
      } else if (nrOfInstances < 0) {
        throw new ActivitiIllegalArgumentException("Invalid number of instances: must be a non-negative integer value" + ", but was " + nrOfInstances);
      }
      
      // Create child execution that will execute the inner behavior
      ExecutionEntity childExecution = Context.getCommandContext().getExecutionEntityManager()
          .createChildExecution((ExecutionEntity) multiInstanceExecution);
      childExecution.setCurrentFlowElement(multiInstanceExecution.getCurrentFlowElement());
      multiInstanceExecution.setMultiInstanceRoot(true);
      multiInstanceExecution.setActive(false);
      
      // Set Multi-instance variables
      setLoopVariable(multiInstanceExecution, NUMBER_OF_INSTANCES, nrOfInstances);
      setLoopVariable(multiInstanceExecution, NUMBER_OF_COMPLETED_INSTANCES, 0);
      setLoopVariable(multiInstanceExecution, NUMBER_OF_ACTIVE_INSTANCES, 1);
      setLoopVariable(childExecution, getCollectionElementIndexVariable(), 0);
      logLoopDetails(multiInstanceExecution, "initialized", 0, 0, 1, nrOfInstances);
  
      if (nrOfInstances > 0) {
        executeOriginalBehavior(childExecution, 0);
      }
      return nrOfInstances;
    }