protected void deleteThemeSettingsProperties(
      UnicodeProperties typeSettingsProperties, String device) {

    String keyPrefix = ThemeSettingImpl.namespaceProperty(device);

    Set<String> keys = typeSettingsProperties.keySet();

    Iterator<String> itr = keys.iterator();

    while (itr.hasNext()) {
      String key = itr.next();

      if (key.startsWith(keyPrefix)) {
        itr.remove();
      }
    }
  }
  protected UnicodeProperties addLDAPServer(long companyId, UnicodeProperties properties)
      throws Exception {

    String defaultPostfix = LDAPSettingsUtil.getPropertyPostfix(0);

    String[] defaultKeys = new String[_KEYS.length];

    for (int i = 0; i < _KEYS.length; i++) {
      defaultKeys[i] = _KEYS[i] + defaultPostfix;
    }

    long ldapServerId = CounterLocalServiceUtil.increment();

    String postfix = LDAPSettingsUtil.getPropertyPostfix(ldapServerId);

    String[] keys = properties.keySet().toArray(new String[0]);

    for (String key : keys) {
      if (ArrayUtil.contains(defaultKeys, key)) {
        String value = properties.remove(key);

        if (key.equals(PropsKeys.LDAP_SECURITY_CREDENTIALS + defaultPostfix)
            && value.equals(Portal.TEMP_OBFUSCATION_VALUE)) {

          value = PrefsPropsUtil.getString(PropsKeys.LDAP_SECURITY_CREDENTIALS);
        }

        properties.setProperty(key.replace(defaultPostfix, postfix), value);
      }
    }

    PortletPreferences preferences = PrefsPropsUtil.getPreferences(companyId);

    String ldapServerIds = preferences.getValue("ldap.server.ids", StringPool.BLANK);

    ldapServerIds = StringUtil.add(ldapServerIds, String.valueOf(ldapServerId));

    properties.setProperty("ldap.server.ids", ldapServerIds);

    return properties;
  }