class PreferenceManager {

    @Transactional(propagation = Propagation.REQUIRED)
    public List<Preference> update(List<Preference> preferences) {
        Assert.isTrue(preferences.stream().allMatch(p -> StringUtils.isNotBlank(p.getName())),
                messageHelper.getMessage(MessageConstants.ERROR_PREFERENCE_NAME_NOT_SPECIFIED));

        systemPreferences.validate(preferences);

        preferences.forEach(p -> {
            preferenceDao.upsertPreference(mergeWithDefaults(p));
            notifyPreferenceChanged(p);
        });

        return preferences;
    }

}