Data in database not deleted after deleting block

Permalink
Dear all,

I have a block for system IDs. When I save a block a new entry is made in the DB.
I need always the newest entry. So I write a secound entry in a seperate table (only the bID). When I save the block or duplicate it, there is no problem (see code snipped) but when I delete the block the entry in the systemActive table is still there.

I know the data will be in the table until the last version of this block is deleted and I cannot use a single page because the content of this is not in the search.

Have somebody an idea what I can do?

public function delete()
    {
        $db = Database::connection();
        $db->delete('btSystemActive', array('bID' => $this->bID));
        parent::delete();
    }
    public function duplicate($newBID)
    {
        $db = Database::connection();
        $db->delete('btSystemActive', array('bID' => $this->bID));
        $v1 = array($newBID);
      $q1 = "INSERT INTO btSystemActive (bID) VALUES (?)";
      $db->query($q1, $v1);
        parent::duplicate($newBID);
    }

GunterSchmitt