public function delete($recursive = false)
    {
        $dn = $this->getDn();

        if ($this->exists === false || empty($dn)) {
            // Make sure the record exists before we can delete it.
            // Otherwise, we'll throw an exception.
            throw (new ModelDoesNotExistException())->setModel(get_class($this));
        }

        $this->fireModelEvent(new Events\Deleting($this));

        if ($recursive) {
            // If recursive is requested, we'll retrieve all direct leaf nodes
            // by executing a 'listing' and delete each resulting model.
            $this->newQuery()->listing()->in($this->getDn())->get()->each(function (Model $model) use ($recursive) {
                $model->delete($recursive);
            });
        }

        if ($this->query->getConnection()->delete($dn)) {
            // If the deletion was successful, we'll mark the model
            // as non-existing and fire the deleted event.
            $this->exists = false;

            $this->fireModelEvent(new Events\Deleted($this));

            return true;
        }

        return false;
    }