class PreferenceSaver {

    public void fromJSON(String content, @Nullable ActionListener listener) {
        try {
            JSONObject settingsJson = new JSONObject(content);
            Map<String, Object> generalPrefs = convertJSONToMap(settingsJson.getJSONObject("general"));
            Map<String, Object> adminPrefsJson = convertJSONToMap(settingsJson.getJSONObject("admin"));

            if (!(new PreferenceValidator(GENERAL_KEYS).isValid(generalPrefs))) {
                if (listener != null) {
                    listener.onFailure(new GeneralSharedPreferences.ValidationException());
                }

                return;
            }

            saveGeneralPrefs(generalSharedPreferences, generalPrefs);
            saveAdminPrefs(adminSharedPreferences, adminPrefsJson);

            AutoSendPreferenceMigrator.migrate(settingsJson.getJSONObject("general"));

            if (listener != null) {
                listener.onSuccess();
            }
        } catch (JSONException exception) {
            if (listener != null) {
                listener.onFailure(exception);
            }
        }
    }

    public  PreferenceSaver(GeneralSharedPreferences generalSharedPreferences, AdminSharedPreferences adminSharedPreferences);

}