private void updateCollectionSettings(Collection collection, Collection newCollection) { ContentSettings contentSettings = null; final Map<String, String> settings = new HashMap<String, String>(); if (collection.getContentSettings() != null && collection.getContentSettings().size() > 0) { contentSettings = collection.getContentSettings().iterator().next(); final Map<String, String> contentSettingsMap = JsonDeserializer.deserialize( contentSettings.getData(), new TypeReference<Map<String, String>>() {}); settings.putAll(contentSettingsMap); } settings.putAll(newCollection.getSettings()); newCollection.setSettings(settings); ContentSettings contentSetting = contentSettings == null ? new ContentSettings() : contentSettings; contentSetting.setContent(collection); contentSetting.setData( new JSONSerializer().exclude(EXCLUDE).serialize(newCollection.getSettings())); this.getCollectionDao().save(contentSetting); }