code: private void filterEmbeddedGalleryOptions(JSONObject json) {
  
          Set<String> validKeys = Sets.newHashSet(
              Arrays.asList(
                  I_CmsGalleryProviderConstants.CONFIG_GALLERY_TYPES,
                  I_CmsGalleryProviderConstants.CONFIG_GALLERY_PATH,
                  I_CmsGalleryProviderConstants.CONFIG_USE_FORMATS,
                  I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMAT_NAMES,
                  I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMATS));
  
          // delete all keys not listed above
          Set<String> toDelete = new HashSet<String>(Sets.difference(json.keySet(), validKeys));
          for (String toDeleteKey : toDelete) {
              json.remove(toDeleteKey);
          }
      }
docs: Removes all keys from the given JSON object which do not directly result from the embedded gallery configuration strings.<p>
  
  @param json the JSON object to modify