protected function addByUser(array $data)
    {
        $result = null;
        $this->hook->attach('rating.add.user.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        if (empty($data['rating'])) {
            return 0; // Do not add rating 0 (unvote)
        }

        $result = $this->db->insert('rating_user', $data);
        $this->hook->attach('rating.add.user.after', $data, $result, $this);
        return (int) $result;
    }