public function addVote($intItemId, $fltValue, $blnLock = false)
    {
        if ($this->getSessionBag()->get($this->getLockId($intItemId))) {
            return;
        }

        $arrData = $this->getDataFor([$intItemId]);

        if (!$arrData || !$arrData[$intItemId]['votecount']) {
            $voteCount   = 0;
            $prevPercent = 0;
        } else {
            $voteCount   = $arrData[$intItemId]['votecount'];
            $prevPercent = (float) $arrData[$intItemId]['meanvalue'];
        }

        $grandTotal = ($voteCount * $this->get('rating_max') * $prevPercent);
        $hundred    = ($this->get('rating_max') * (++$voteCount));

        // Calculate the percentage.
        $value = (1 / $hundred * ($grandTotal + $fltValue));

        $arrSet = [
            'mid' => $this->getMetaModel()->get('id'),
            'aid' => $this->get('id'),
            'iid' => $intItemId,
            'votecount' => $voteCount,
            'meanvalue' => $value,
        ];

        $queryBuilder = $this->connection->createQueryBuilder();

        if (!$arrData || !$arrData[$intItemId]['votecount']) {
            $queryBuilder
                ->insert('tl_metamodel_rating')
                ->values($arrSet);
        } else {
            foreach ($arrSet as $key => $value) {
                $queryBuilder
                    ->set($key, ':' . $key)
                    ->setParameter($key, $value);
            }

            $queryBuilder
                ->update('tl_metamodel_rating')
                ->andWhere('mid=:mid AND aid=:aid AND iid=:iid')
                ->setParameter('mid', $this->getMetaModel()->get('id'))
                ->setParameter('aid', $this->get('id'))
                ->setParameter('iid', $intItemId);
        }

        $queryBuilder->execute();

        if ($blnLock) {
            $this->getSessionBag()->set($this->getLockId($intItemId), true);
        }
    }