private void CheckSessions()
        {
            var now = TimeProvider.Now.ToUniversalTime();

            foreach (var expiredSession in _sessions.Values.AsParallel().Where((s) => s.ExpiresBy(now)))
            {
                ISessionState externalSession = _sessionStateProvider.GetSessionState(expiredSession.SessionKey) ?? expiredSession;
                if (externalSession.ExpiresBy(now))
                {
                    KillSession(expiredSession.SessionKey, SessionEndingReason.EXPIRED);
                }
                else
                {
                    _sessions[expiredSession.SessionKey] = externalSession;
                }
            }

            var expiresBy = now + TimeSpan.FromSeconds(_config.WarnUserSessionExpirationSeconds);

            foreach (var expiringSession in _sessions.Values.AsParallel().Where((s) => s.ExpiresBy(expiresBy)))
            {
                ISessionState externalSession = _sessionStateProvider.GetSessionState(expiringSession.SessionKey) ?? expiringSession;
                _sessions[expiringSession.SessionKey] = externalSession;
                if (externalSession.ExpiresBy(expiresBy))
                {
                    RaiseSessionExpiring(expiringSession, expiringSession.Expires);
                }
            }
        }