public function save()
 {
     foreach ($this->getAttributes() as $prop => $value) {
         $setting = SiteVariable::model()->findByPk($prop);
         if (!$setting) {
             $setting = new SiteVariable();
             $setting->variable = $prop;
             $setting->title = $this->getAttributeLabel($prop);
         }
         $setting->value = $this->{$prop};
         //            print_r($this);exit;
         $setting->save(false);
     }
 }
 public static function newCounter($name)
 {
     return SiteVariable::save("uniqueIDs", $name, 1);
 }