public function delete(bool $deep = false, bool $children = false,
                           bool $references = false) {
        $this->uri      = $this->fedora->sanitizeUri($this->getUri());
        $fedoraChildren = $this->getMetadata()->allResources(self::CONTAINS_PROP);
        if (count($fedoraChildren) > 0) {
            throw new RuntimeException("A resource has Fedora children");
        }
        $request = new Request('DELETE', $this->uri);
        $this->fedora->sendRequest($request);
        $this->fedora->getCache()->delete($this);
        if ($deep) {
            $request = new Request('DELETE', $this->uri . '/fcr:tombstone');
            $this->fedora->sendRequest($request);
        }

        try {
            $this->getAcl()->deleteAcl();
        } catch (NotFound $e) {
            
        } catch (Deleted $e) {
            
        }

        if ($children) {
            foreach ($this->getChildren() as $i) {
                $i->delete($deep, $children, $references);
            }
        }

        if ($references) {
            $id      = $this->getId();
            $query   = new SimpleQuery('SELECT * WHERE {?res ?prop ?@}');
            $query->setValues(array($id));
            $results = $this->fedora->runQuery($query);
            foreach ($results as $i) {
                try {
                    $res  = $this->fedora->getResourceByUri($i->res);
                    $meta = $res->getMetadata();
                    foreach ($meta->propertyUris() as $prop) {
                        $meta->deleteResource($prop, $id);
                    }
                    $res->setMetadata($meta);
                    $res->updateMetadata(self::OVERWRITE);
                } catch (Deleted $e) {
                    
                } catch (NotFound $e) {
                    
                }
            }
        }
    }