if(userId != null) {
if (task.getAssignee() != null) {
if(!task.getAssignee().equals(userId)) {
// When the task is already claimed by another user, throw exception. Otherwise, ignore
// this, post-conditions of method already met.
throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee());
}
} else {
task.setAssignee(userId, true, true);
}
} else {