@Override
  public void addClaimedUser(Context context, XmlWorkflowItem wfi, Step step, EPerson user)
      throws SQLException, AuthorizeException, IOException {

    // Make sure we delete the pooled task for our current user if the task is not a group pooltask
    PoolTask task = poolTaskService.findByWorkflowIdAndEPerson(context, wfi, user);
    if (task != null && task.getEperson() != null) {
      xmlWorkflowService.deletePooledTask(context, wfi, task);
    }

    InProgressUser ipu = inProgressUserService.create(context);
    ipu.setWorkflowItem(wfi);
    ipu.setUser(user);
    ipu.setFinished(false);
    inProgressUserService.update(context, ipu);
    int totalUsers =
        inProgressUserService.getNumberOfInProgressUsers(context, wfi)
            + inProgressUserService.getNumberOfFinishedUsers(context, wfi);

    if (totalUsers == step.getRequiredUsers()) {
      // If enough users have claimed/finished this step then remove the tasks
      xmlWorkflowService.deleteAllPooledTasks(context, wfi);
    }
    xmlWorkflowItemService.update(context, wfi);
  }
 @Override
 public void addFinishedUser(Context c, XmlWorkflowItem wfi, EPerson user)
     throws AuthorizeException, SQLException {
   InProgressUser ipu = inProgressUserService.findByWorkflowItemAndEPerson(c, wfi, user);
   ipu.setFinished(true);
   inProgressUserService.update(c, ipu);
 }