/**
  * Save
  *
  */
 function save()
 {
     parent::save();
     // If more than 10 passwords, delete oldest
     $passwords = UserPasswords::findAll(array('conditions' => array('`user_id` = ?', $this->getUserId())));
     if (count($passwords) > 10) {
         $oldest = UserPasswords::getOldestUserPassword($this->getUserId());
         $oldest[0]->delete();
     }
 }
 /**
  * Return newest user passwords for all users
  *
  * @access public
  * @return array
  */
 static function getNewestUserPasswords()
 {
     return UserPasswords::findAll(array('order' => 'password_date desc', 'group by' => 'user_id'));
     // findAll
 }