Prevent duplicate ratings when saving to database