public function delete()
{
$this->events()->trigger(__CLASS__, 'before.delete', $this);
$moduleId = $this->getId();
if (!empty($moduleId)) {
try {
parent::delete(array('id' => $moduleId));
} catch (\Exception $e) {
throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
}
$this->events()->trigger(__CLASS__, 'after.delete', $this);
unset($this);
return true;
}
$this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
return false;
}