public function getPreviousRoundId($roundId, $roundOrder = null)
    {
       $this->_ensureRounds();

       if ($this->_rounds && $roundId) {
           $returnId = null;
           foreach ($this->_rounds as $currentRoundId => $round) {
               if (($currentRoundId == $roundId) || ($roundOrder && ($round['gro_id_order'] >= $roundOrder))) {
                   // Null is returned when querying this function with the first round id.
                   return $returnId;
               }
               $returnId = $currentRoundId;
           }


           throw new \Gems_Exception_Coding("Requested non existing previous round id for round $roundId.");

       } elseif ($this->_rounds) {
            end($this->_rounds);
            $key = key($this->_rounds);
            if (empty($key) && !is_null($key)) {
                // The last round (with empty index) is the current round, step back one more round
                prev($this->_rounds);
            }
            return key($this->_rounds);
        }
    }