private static void UpdateEnrollmentTimestamp(Enrollment enrollment, DhisApi dhisApi)
      throws APIException {
    try {
      final Map<String, String> QUERY_PARAMS = new HashMap<>();
      QUERY_PARAMS.put("fields", "created,lastUpdated");
      Enrollment updatedEnrollment =
          dhisApi.getEnrollment(enrollment.getEnrollment(), QUERY_PARAMS);

      // merging updated timestamp to local enrollment model
      enrollment.setCreated(updatedEnrollment.getCreated());
      enrollment.setLastUpdated(updatedEnrollment.getLastUpdated());
      enrollment.save();
    } catch (APIException apiException) {
      NetworkUtils.handleApiException(apiException);
    }
  }
  private static void putEnrollment(Enrollment enrollment, DhisApi dhisApi) throws APIException {
    try {
      Response response = dhisApi.putEnrollment(enrollment.getEnrollment(), enrollment);
      if (response.getStatus() == 200) {
        ImportSummary importSummary = getImportSummary(response);
        handleImportSummary(importSummary, FailedItem.ENROLLMENT, enrollment.getLocalId());

        if (ImportSummary.SUCCESS.equals(importSummary.getStatus())
            || ImportSummary.OK.equals(importSummary.getStatus())) {

          // enrollment.setState(State.SYNCED);
          enrollment.setFromServer(true);
          enrollment.save();
          clearFailedItem(FailedItem.ENROLLMENT, enrollment.getLocalId());
          UpdateEnrollmentTimestamp(enrollment, dhisApi);
        }
      }
    } catch (APIException apiException) {
      NetworkUtils.handleEnrollmentSendException(apiException, enrollment);
    }
  }