LumifyVisibility lumifyVisibility = visibilityTranslator.toVisibility(visibilityJson);
ExistingElementMutation m = element.prepareMutation().alterElementVisibility(lumifyVisibility.getVisibility());
if (LumifyProperties.VISIBILITY_JSON.getPropertyValue(element) != null) {
Property visibilityJsonProperty = LumifyProperties.VISIBILITY_JSON.getProperty(element);
m.alterPropertyVisibility(visibilityJsonProperty.getKey(), LumifyProperties.VISIBILITY_JSON.getPropertyName(), lumifyVisibility.getVisibility());
}
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(LumifyProperties.VISIBILITY_JSON.getPropertyName(), visibilityJson.toString());
LumifyProperties.VISIBILITY_JSON.setProperty(m, visibilityJson, metadata, lumifyVisibility.getVisibility());