protected internal virtual void TerminateAllBehaviour(IExecutionEntity execution, ICommandContext commandContext, IExecutionEntityManager executionEntityManager) { IExecutionEntity rootExecutionEntity = executionEntityManager.FindByRootProcessInstanceId(execution.RootProcessInstanceId); string deleteReason = CreateDeleteReason(execution.CurrentActivityId); DeleteExecutionEntities(executionEntityManager, rootExecutionEntity, deleteReason); EndAllHistoricActivities(rootExecutionEntity.Id, deleteReason); commandContext.HistoryManager.RecordProcessInstanceEnd(rootExecutionEntity.Id, deleteReason, execution.CurrentActivityId); }