public function delete($id)
    {
        $this->loadModel('Block.Blocks');
        $block = $this->Blocks->find()
            ->where(['id' => $id])
            ->first();

        if ($block &&
            ($block->handler == 'Block' || !empty($block->copy_id))
        ) {
            if ($this->Blocks->delete($block)) {
                $this->Flash->success(__d('block', 'Block was successfully removed!'));
            } else {
                $this->Flash->danger(__d('block', 'Block could not be removed'));
            }
        } else {
            $this->Flash->warning(__d('block', 'Block not found!'));
        }

        $this->title(__d('block', 'Delete Block'));
        $this->redirect($this->referer());
    }