public function activateUser($data)
 {
     if (!is_array($data)) {
         throw new \Exception('Data parameter should be an array');
     }
     if (empty($data) && empty($data['email'])) {
         throw new \Exception('Data parameter should not be empty');
     }
     $where = array('email' => strip_tags(trim(base64_decode($data['email']))));
     $affected = MvcDb::init()->update(array('is_active' => 1), 'users')->where($where)->execute()->getAffectedRows();
     return $affected;
 }
 public function insertUserPhones(&$data, $id)
 {
     if (empty($data)) {
         throw new \Exception('Data parameter should not be empty');
     }
     if (!is_array($data['phonenumber'])) {
         throw new \Exception('Phone Number should be an array');
     }
     $phone_id = $values = array();
     foreach ($data['phonenumber'] as $value) {
         if (is_numeric($value)) {
             $phone_id[] = MvcDb::init()->insert(array('user_id', 'phone_number'), 'phone_numbers', array($id, $value))->execute()->getLastInsertId();
         }
     }
     $data['phonenumber'] = implode(',', $data['phonenumber']);
     return count($phone_id);
 }