class AlfrescoSyncService implements ApplicationEventPublisherAware {

    protected void updatePropertiesWithLastAuditId(String lastAuditIdKey, JSONObject fullAuditResponse)
    {
        // some of the readers ignore some events. So we want to store the last audit id from the full
        // response... not the last audit id returned by the reader.
        JSONArray allAudits = fullAuditResponse.getJSONArray("entries");
        int numAudits = allAudits.length();

        if (numAudits > 0)
        {
            long lastAuditFromFullResponse = allAudits.getJSONObject(numAudits - 1).getLong("id");
            Map<String, String> properties = Collections.singletonMap(lastAuditIdKey, String.valueOf(lastAuditFromFullResponse));
            getPropertyFileManager().storeMultiple(properties, getAuditApplicationLastAuditIdsFilename(), false);
        }
    }

}