Activerecord::beforesave Doesn't Allow To Change Isnewrecord

This is my code:

public function beforeSave() {

	if ($this->isNewRecord) { // check if value already exists in the db


		if ($t) { // update only





	return parent::beforeSave();


The record still gets inserted in the database, because beforeSave() is called from the insert() method !

So, should this validation be done in beforeValidate, or the CActiveRecord implementation should be modified to call beforeSave() inside the save() method ?