public override IPvmProcessInstance CreateProcessInstance(string businessKey, string caseInstanceId, ActivityImpl initial)
        {
            EnsureNotSuspended();

            ExecutionEntity processInstance = (ExecutionEntity)CreateProcessInstanceForInitial(initial);

            //// do not reset executions (CAM-2557)!
            processInstance.SetExecutions(new List <IActivityExecution>());//.SetExecutions(new ArrayList<ExecutionEntity>());


            processInstance.SetProcessDefinition(processDefinition);

            //// Do not initialize variable map (let it happen lazily)

            //// reset the process instance in order to have the db-generated process instance id available
            processInstance.SetProcessInstance(processInstance);

            //// initialize business key
            if (businessKey != null)
            {
                processInstance.BusinessKey = businessKey;
            }

            //// initialize case instance id
            if (caseInstanceId != null)
            {
                processInstance.CaseInstanceId = caseInstanceId;
            }

            if (TenantId != null)
            {
                processInstance.TenantId = TenantId;
            }

            return(processInstance);
        }