private function saveVariation(Experiment $experiment, Variation $variation, UserProfile $userProfile)
    {
        if (is_null($this->_userProfileService)) {
            return;
        }

        $experimentId = $experiment->getId();
        $decision = $userProfile->getDecisionForExperiment($experimentId);
        $variationId = $variation->getId();
        if (is_null($decision)) {
            $decision = new Decision($variationId);
        } else {
            $decision->setVariationId($variationId);
        }

        $userProfile->saveDecisionForExperiment($experimentId, $decision);
        $userProfileMap = UserProfileUtils::convertUserProfileToMap($userProfile);

        try {
            $this->_userProfileService->save($userProfileMap);
            $this->_logger->log(
                Logger::INFO,
                sprintf(
                    'Saved variation "%s" of experiment "%s" for user "%s".',
                    $variation->getKey(),
                    $experiment->getKey(),
                    $userProfile->getUserId()
                )
            );
        } catch (Exception $e) {
            $this->_logger->log(
                Logger::WARNING,
                sprintf(
                    'Failed to save variation "%s" of experiment "%s" for user "%s".',
                    $variation->getKey(),
                    $experiment->getKey(),
                    $userProfile->getUserId()
                )
            );
        }
    }