docs: protected ActivityImpl determineFirstActivity(ProcessDefinitionImpl processDefinition,
        ProcessInstanceModificationBuilderImpl modificationBuilder) {
      AbstractProcessInstanceModificationCommand firstInstruction = modificationBuilder.getModificationOperations().get(0);
  
      if (firstInstruction instanceof AbstractInstantiationCmd) {
        AbstractInstantiationCmd instantiationInstruction = (AbstractInstantiationCmd) firstInstruction;
        CoreModelElement targetElement = instantiationInstruction.getTargetElement(processDefinition);
  
        ensureNotNull(NotValidException.class,
            "Element '" + instantiationInstruction.getTargetElementId() + "' does not exist in process " + processDefinition.getId(),
            "targetElement",
            targetElement);
  
        if (targetElement instanceof ActivityImpl) {
          return (ActivityImpl) targetElement;
        }
        else if (targetElement instanceof TransitionImpl) {
          return (ActivityImpl) ((TransitionImpl) targetElement).getDestination();
        }
  
      }
  
      return null;
    }