public function delete($id)
{
if (!($gp = $this->model->findByPk($id))) {
throw new NotFound("GP with ID '{$id}' not found");
}
$crit = new \CDbCriteria();
$crit->compare('gp_id', $id);
\Patient::model()->updateAll(array('gp_id' => null), $crit);
$gp->delete();
}