public virtual object Execute(CommandContext commandContext) { EnsureUtil.EnsureNotNull("taskId", TaskId); ITaskManager taskManager = commandContext.TaskManager; Task = taskManager.FindTaskById(TaskId); EnsureUtil.EnsureNotNull("Cannot find ITask with id " + TaskId, "ITask", Task); CheckAddIdentityLink(Task, commandContext); if (IdentityLinkType.Assignee.Equals(Type)) { Task.Assignee = UserId; } else if (IdentityLinkType.Owner.Equals(Type)) { Task.Owner = UserId; } else { Task.AddIdentityLink(UserId, GroupId, Type); } return(null); }