public virtual object Execute(CommandContext commandContext) { EnsureUtil.EnsureNotNull("taskId", TaskId); ITaskManager taskManager = commandContext.TaskManager; TaskEntity task = taskManager.FindTaskById(TaskId); EnsureUtil.EnsureNotNull("Cannot find ITask with id " + TaskId, "ITask", task); CheckDelegateTask(task, commandContext); task.Delegate(UserId);//.@delegate(userId); task.CreateHistoricTaskDetails(UserOperationLogEntryFields.OperationTypeDelegate); return(null); }