private void addPostActionParametersToTaskContext(
      ActionEvent action, Integer actionIndex, TaskContext taskContext, Object object)
      throws TaskHandlerException {
    for (ActionParameter postActionParameter : action.getPostActionParameters()) {

      taskContext.addPostActionParameterObject(
          actionIndex.toString(), postActionParameter.getKey(), object, true);
    }
  }
  private Map<String, Object> createParameters(
      TaskActionInformation info, ActionEvent action, KeyEvaluator keyEvaluator)
      throws TaskHandlerException {
    SortedSet<ActionParameter> actionParameters = action.getActionParameters();
    Map<String, Object> parameters = new HashMap<>(actionParameters.size());

    for (ActionParameter actionParameter : actionParameters) {
      String key = actionParameter.getKey();

      if (info.getValues().containsKey(key)) {
        String template = info.getValues().get(key);

        if (template == null) {
          throw new TaskHandlerException(
              TRIGGER, "task.error.templateNull", key, action.getDisplayName());
        }

        switch (actionParameter.getType()) {
          case LIST:
            parameters.put(key, convertToList((List<String>) LIST.parse(template), keyEvaluator));
            break;
          case MAP:
            parameters.put(key, convertToMap(template, keyEvaluator));
            break;
          default:
            try {
              String userInput = keyEvaluator.evaluateTemplateString(template);
              Object obj = actionParameter.getType().parse(userInput);
              parameters.put(key, obj);
            } catch (MotechException ex) {
              throw new TaskHandlerException(TRIGGER, ex.getMessage(), ex, key);
            }
        }
      } else {
        if (actionParameter.isRequired()) {
          throw new TaskHandlerException(
              TRIGGER, "task.error.taskActionNotContainsField", action.getDisplayName(), key);
        } else if (actionParameter.getType() == MAP) {
          parameters.put(key, new HashMap<>());
        } else if (actionParameter.getType() == LIST) {
          parameters.put(key, new ArrayList<>());
        } else {
          parameters.put(key, null);
        }
      }
    }

    return parameters;
  }