title: How to resolve Call to undefined method stdClass::save()
body: <p>I am currently working on <code>Yii</code>. I want to check that if some value is exists into database then echo something otherwise <code>save into database</code>.</p>
  
  <p>I am doing:</p>
  
  <pre><code>    $model = Users::model()-&gt;findByAttributes(array('googleid'=&gt;$google_id));
          if($model)
          {
              echo "Good";
          }
          else
          {
              echo $model-&gt;googleid = $google_id;
  
                      $model-&gt;save();
          }
  </code></pre>
  
  <p>But when I am running this code then I am getting error :</p>
  
  <pre><code>Fatal error: Call to undefined method stdClass::save() in E:\wamp\www\customers\protected\views\users\googlelogin.php on line 76
  </code></pre>
  
  <p>What may be the reason for this error, I am unable to figure out, please help me </p>
  
  <p>Thanks in advance</p>