Update Another Model Yii

i have 4 data table

1.comment table

2.driver detail table

TABLE comments (

CommentId int(11),

UserId int(11) ,

Comment text,

Rating int(1),

PRIMARY KEY (CommentId),

);

TABLE driverdetails (

DriverDetailId int(11),

UserId int(11) NOT NULL,

AvarageRating double NOT NULL,

PRIMARY KEY (DriverDetailId),

KEY UserId (UserId)

);

[color="#FF0000"]IMP i removed some data feild to get easy to undestand what i explain[/color]

What i need to do is

when user update comment i need to update AvarageRating feild in driverdetails table

i using rating algorithm to calculate AvarageRating please dont mine that simply

whan user update  rating as 4 ---> i need to update drierdetail table ---> AvarageRating 

i want to da this actionUpdate not a action create

this is my action update

///////////////////////////////////

public function actionUpdate($id)


{


	$model=$this->loadModel($id);





	// Uncomment the following line if AJAX validation is needed


	// $this->performAjaxValidation($model);





	if(isset($_POST['Comments']))


	{


		$model->attributes=$_POST['Comments'];


		if($model->save())


			$this->redirect(array('view','id'=>$model->CommentId));


	}





	$this->render('update',array(


		'model'=>$model,


	));


}

//////////////////////////////////////

public function loadModel($id)

{


	$model=Comments::model()->findByPk($id);


	if($model===null)


		throw new CHttpException(404,'The requested page does not exist.');


	return $model;


}

public function actionUpdate($id)

{


	$model=$this->loadModel($id);


            $driver = Driverdetails::model()->findByAttributes(array('UserId'=>$model->DriverId));


	// Uncomment the following line if AJAX validation is needed


	// $this->performAjaxValidation($model);


             // $driver = Driverdetails::model()->findByAttributes(array('UserId'=>$model->DriverId));


                


                  //  $drier->AvarageRating=2;


                   //$drier->save();


               


	if(isset($_POST['Comments']))


	{


		$model->attributes=$_POST['Comments'];


                    


                    


                    $driver->AvarageRating=$model->Rating;


		if($model->save() && $driver->save())


			$this->redirect(array('view','id'=>$model->CommentId));


	}





	$this->render('update',array(


		'model'=>$model,


	));


}