protected async Task<Session> GetSession(CancellationToken cancellationToken)
        {
            if (this.loadedSession)
            {
                return this.currentSession;
            }

            this.currentSession = null;
            var cookie = this.Request.Cookies[SessionIdKey];
            if (cookie == null || string.IsNullOrWhiteSpace(cookie.Value))
            {
                return null;
            }

            var session = new Session { SessionId = cookie.Value };
            session = await this.sessionStore.Get(session.PartitionKey, session.RowKey, cancellationToken);

            if (session == null || Clock.UtcNow > session.ExpirationTime)
            {
                return null;
            }

            this.currentSession = session;
            return this.currentSession;
        }
        private async Task CreateNewSession(Account account, bool rememberMe, CancellationToken cancellationToken)
        {
            var session = new Session
            {
                AccountId = account.AccountId,
                AccountName = account.Name,
                AccountIdentity = account.IdentityValue,
                CreationTime = Clock.UtcNow,
                ExpirationTime = DateTime.MaxValue,
                SessionId = Guid.NewGuid().ToString(),
            };

            await this.sessionStore.Insert(session, cancellationToken);

            var cookie = new HttpCookie(SessionIdKey, session.SessionId)
            {
                Expires = Clock.UtcNow + (rememberMe ? TimeSpan.FromDays(7) : TimeSpan.FromHours(2)),
            };

            this.Response.SetCookie(cookie);
        }