public function delete(LdapObject $ldapObject, $recursively = false)
{
$this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_DELETE, $ldapObject));
$this->validateObject($ldapObject);
$operation = new DeleteOperation($ldapObject->get('dn'));
if ($recursively) {
$operation->addControl((new LdapControl(LdapControlType::SUB_TREE_DELETE))->setCriticality(true));
}
$this->connection->execute($operation);
$this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_DELETE, $ldapObject));
}