$model->attributes = $key;
will not work, because $this->findbyAttributes
returns a type of CActiveRecord(CModel).
To copy attributes from one model to another, use the setAttributes()
method with the second flag set to false.
$model->setAttributes($key->attributes, false);
http://www.yiiframework.com/doc/api/1.1/CModel#setAttributes-detail