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

		$t=$this->findByAttributes($this->getAttributes(array('column','table','value')));

		if ($t) { // update only

			$this->id=$t->id;

			$this->setIsNewRecord(false);

		}

	}

	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 ?