public function restoreCurrentCart(CartRestoreEvent $cartRestoreEvent, $eventName, EventDispatcherInterface $dispatcher)
    {
        $cookieName = ConfigQuery::read("cart.cookie_name", 'thelia_cart');
        $persistentCookie = ConfigQuery::read("cart.use_persistent_cookie", 1);

        $cart = null;

        if ($this->requestStack->getCurrentRequest()->cookies->has($cookieName) && $persistentCookie) {
            $cart = $this->managePersistentCart($cartRestoreEvent, $cookieName, $dispatcher);
        } elseif (!$persistentCookie) {
            $cart = $this->manageNonPersistentCookie($cartRestoreEvent, $dispatcher);
        }

        // Still no cart ? Create a new one.
        if (null === $cart) {
            $cart = $this->dispatchNewCart($dispatcher);
        }

        $cartRestoreEvent->setCart($cart);
    }