protected function prepareForNextMessage($messageName, $messageOptions)
    {
        if (!$this->isAuthenticated && $messageName !== 'Security_Authenticate') {
            throw new InvalidSessionException('No active session');
        }

        $this->getSoapClient($messageName)->__setSoapHeaders(null);

        if ($this->isAuthenticated === true && is_int($this->sessionData['sequenceNumber'])) {
            $this->sessionData['sequenceNumber']++;

            $session = new Client\Struct\HeaderV2\Session(
                $this->sessionData['sessionId'],
                $this->sessionData['sequenceNumber'],
                $this->sessionData['securityToken']
            );

            $this->getSoapClient($messageName)->__setSoapHeaders(
                new \SoapHeader(self::CORE_WS_V2_SESSION_NS, self::NODENAME_SESSION, $session)
            );
        }
    }