public function save() { /*saves the data in the db*/ $newMainAccount = new MainAccount(); $newMainAccount->attributes = $this->attributes; if (!$newMainAccount->save()) { throw new Exception("Sorry cant save new Main account . Reason : " . CHtml::errorSummary($newMainAccount)); } return $newMainAccount; }