code: public Object getPersistentState() {
      Map<String, Object> persistentState = new HashMap<String, Object>();
      persistentState.put("name", name);
      persistentState.put("owner", owner);
      persistentState.put("assignee", assignee);
      persistentState.put("endTime", endTime);
      persistentState.put("durationInMillis", durationInMillis);
      persistentState.put("description", description);
      persistentState.put("deleteReason", deleteReason);
      persistentState.put("taskDefinitionKey", taskDefinitionKey);
      persistentState.put("formKey", formKey);
      persistentState.put("priority", priority);
      persistentState.put("category", category);
      persistentState.put("processDefinitionId", processDefinitionId);
      if (parentTaskId != null) {
        persistentState.put("parentTaskId", parentTaskId);
      }
      if (dueDate != null) {
        persistentState.put("dueDate", dueDate);
      }
      if (claimTime != null) {
        persistentState.put("claimTime", claimTime);
      }
      return persistentState;
    }
docs: persistence //////////////////////////////////////////////////////////////