/**
  * Move an entry to a new DN.
  *
  * @param string $dn
  *   The distinguished name of an LDAP entry.
  * @param string $newdn
  *   The new distinguished name of the LDAP entry.
  * @param boolean $deleteoldrdn
  *   If TRUE the old RDN value(s) is removed, else the old RDN value(s) is
  *   retained as non-distinguished values of the entry.
  *
  * @return boolean
  *   TRUE on success
  *
  * @throw SimpleLdapException
  */
 public function move($dn, $newdn, $deleteoldrdn = TRUE)
 {
     // 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();
     // Parse $newdn into a format that ldap_rename() can use.
     $parts = SimpleLdap::ldap_explode_dn($newdn, 0);
     $rdn = $parts[0];
     $parent = '';
     for ($i = 1; $i < $parts['count']; $i++) {
         $parent .= $parts[$i];
         if ($i < $parts['count'] - 1) {
             $parent .= ',';
         }
     }
     // Move the entry.
     return SimpleLdap::ldap_rename($this->resource, $dn, $rdn, $parent, $deleteoldrdn);
 }