public function getRecordsListAvgRating($orderBy = "DESC", $limit = 30)
 {
     SwitchDatabase::switchToEcontent();
     $records = array();
     $sql = "SELECT ei.*, AVG(rating) as rate\n\t\t\t\tFROM econtent_rating er join econtent_item ei on er.recordId = ei.id\n\t\t\t\tWHERE 1 GROUP BY recordId ORDER BY rate " . $orderBy . ", recordId DESC LIMIT " . $limit;
     $result = mysql_query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         unset($row['rate']);
         $econtentRecord = new EContentRecord();
         $econtentRecord->get($row['id']);
         $econtentRecord->setFrom($row, '');
         $records[] = $econtentRecord;
         unset($econtentRecord);
     }
     SwitchDatabase::restoreDatabase();
     return $records;
 }