/**
  * Returns all forms.
  *
  * @param string|null $indexBy
  * @return array
  */
 public function getAllForms($indexBy = null)
 {
     if (!$this->_fetchedAllForms) {
         $formRecords = Applications_FormRecord::model()->ordered()->findAll();
         $this->_formsById = Applications_FormModel::populateModels($formRecords, 'id');
         $this->_fetchedAllForms = true;
     }
     if ($indexBy == 'id') {
         return $this->_formsById;
     } else {
         if (!$indexBy) {
             return array_values($this->_formsById);
         } else {
             $forms = array();
             foreach ($this->_formsById as $form) {
                 $forms[$form->{$indexBy}] = $form;
             }
             return $forms;
         }
     }
 }