ObjectMapper mapper = new ObjectMapper();
@SuppressWarnings("unchecked")
Map<String, Object> newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class);
preferencesProvider.deletePreferences(userName);
Map<String, Object> preferences = preferencesProvider.setPreferences(userName, newPreferences);
if (preferences == null)
{
preferences = Collections.<String, Object>emptyMap();
}