protected function getRecord($tableName, $where = null)
    {
        $record = $this->database->table($tableName)->order('RAND()');
        return $where ?
            $record->where($where)->limit(1)->fetch() :
            $record->limit(1)->fetch();
    }