/**
  * Add an entry to the LDAP directory.
  *
  * @param string $dn
  *   The distinguished name of an LDAP entry.
  * @param array $attributes
  *   An array of LDAP attributes and values.
  *
  * @return boolean
  *   TRUE on success.
  *
  * @throw SimpleLdapException
  */
 public function add($dn, $attributes)
 {
     // Make sure changes are allowed.
     if ($this->readonly) {
         throw new SimpleLdapException('The LDAP Server is configured as read-only');
     }
     // Make sure there is a valid binding.
     $this->bind();
     // Clean up the attributes array.
     $attributes = SimpleLdap::removeEmptyAttributes($attributes);
     // Add the entry.
     return SimpleLdap::ldap_add($this->resource, $dn, $attributes);
 }