function createSession(array $cookieData, $userProfile = null)
    {
        if (!array_key_exists($this->sessionConfig->getSessionName(), $cookieData)) {
            return $this->driver->createSession($this, $userProfile);
        }

        $sessionID = $cookieData[$this->sessionConfig->getSessionName()];
        $existingSession = $this->openSessionByID($sessionID, $userProfile);

        if ($existingSession !== null) {
            return $existingSession;
        }
        
        $this->invalidSessionAccessed();
        return $this->driver->createSession($this, $userProfile);
    }