@Override
  @SuppressWarnings("unchecked")
  public JSONObject createJsonObject(Object modelObject) throws JSONException {
    JSONObject result = new JSONObject();
    Map<String, Object> model = getModelAsMap(modelObject);

    JSONUtil.putPagingInfo(result, model);

    List<Task> tasks = (List<Task>) model.get("tasks");
    JSONArray taskArray = JSONUtil.putNewArray(result, "data");

    if (tasks != null) {
      for (Task task : tasks) {
        taskArray.put(converter.getJSONObject(task));
      }
    }
    return result;
  }
  @Override
  @SuppressWarnings("unchecked")
  public JSONObject createJsonObject(Object modelObject) throws JSONException {
    JSONObject result = new JSONObject();
    Map<String, Object> model = getModelAsMap(modelObject);

    List<User> users = (List<User>) model.get("users");

    JSONArray groupsArray = JSONUtil.putNewArray(result, "data");
    if (users != null) {
      for (User user : users) {
        groupsArray.put(converter.getJSONObject(user));
      }
    }

    JSONUtil.putPagingInfo(result, model);

    return result;
  }