public function onAuthenticationSuccess(AuthenticationEvent $event)
    {
        $loggedUser = $event
            ->getAuthenticationToken()
            ->getUser();

        $cart = $this
            ->cartWrapper
            ->get();

        if (
            ($loggedUser instanceof CustomerInterface) &&
            ($cart instanceof CartInterface && $cart->getId())
        ) {
            /*
             * We assume that a cart with an ID is
             * not a pristine entity coming from a
             * factory method. (i.e. has already been
             * flushed)
             */
            $cart->setCustomer($loggedUser);

            $this->cartManager->flush($cart);
        }
    }