public function delete()
    {
        $this->remove_file();

        $connection = $this->getDataboxConnection();

        $connection->executeUpdate(
            'DELETE FROM permalinks WHERE subdef_id = :subdef_id',
            ['subdef_id' => $this->subdef_id]
        );

        self::getMediaSubdefRepository($this->app, $this->record->getDataboxId())->delete($this);
        $this->delete_data_from_cache();
        $this->record->delete_data_from_cache(record_adapter::CACHE_SUBDEFS);
    }