class PsqlEventMapper {

    Event<Map<String, Object>> parseResponse(String responsePayload) {
        try {
            JSONObject jsonResponse = new JSONObject(responsePayload);
            String eventType = jsonResponse.getString(EVENT_TYPE_KEY);
            String tableName = jsonResponse.getString(TABLE_NAME_KEY);
            Map<String, Object> newRow = jsonObjectToMap(jsonResponse.getJSONObject(NEW_ENTITY_KEY));
            Map<String, Object> oldRow = jsonObjectToMap(jsonResponse.getJSONObject(OLD_ENTITY_KEY));

            Event<Map<String, Object>> event = new Event<>(eventType, tableName, newRow, oldRow);
            validateEvent(event);
            return event;
        } catch (JSONException je) {
            throw new InvalidPayloadException("Payload is not a valid json payload", je);
        } catch (InvalidPayloadException ipe) {
            throw new InvalidPayloadException("Payload is not valid.", ipe);
        }
    }

      PsqlEventMapper();

}