public function leave(Session $session)
    {
        /* @var $procedure \Thruway\Procedure */
        foreach ($this->procedures as $procedure) {
            $procedure->leave($session);
        }

        foreach ($this->callInvocationIndex as $call) {
            if ($session->getSessionId() === $call->getCallerSession()->getSessionId()) {
                $cancelMsg = new CancelMessage($call->getCallMessage()->getRequestId(), (object)[]);
                $this->processCancel($session, $cancelMsg);
            }
        }

        // remove the list of registrations
        if ($this->registrationsBySession->contains($session)) {
            $this->registrationsBySession->detach($session);
        }
    }