/// <summary>
        /// Gets or create a user session if one doesn't exist.
        /// </summary>
        /// <param name="userId">The user global id.</param>
        /// <param name="userName">Title of the user.</param>
        /// <param name="shardId"></param>
        /// <returns></returns>
        public UserSession GetOrCreateSession(Guid userId, string userName, string shardId)
        {
            var userSession = this.GetUserSession(userId);
            if (userSession == null)
            {
                userSession = new UserSession(userId, userName, shardId);

                this.cacheClient.Add(userSession.ToCacheKey(), userSession,
                                     userSession.ExpiryDate.GetValueOrDefault(DateTime.UtcNow) + TimeSpan.FromHours(1));
            }
            return userSession;
        }
 /// <summary>
 /// Updates the UserSession in the cache, or removes expired ones.
 /// </summary>
 /// <param name="userSession">The user session.</param>
 public void UpdateUserSession(UserSession userSession)
 {
     var hasSessionExpired = userSession.HasExpired();
     if (hasSessionExpired)
     {
         LogIfDebug("Session has expired, removing: " + userSession.ToCacheKey());
         this.cacheClient.Remove(userSession.ToCacheKey());
     }
     else
     {
         LogIfDebug("Updating session: " + userSession.ToCacheKey());
         this.cacheClient.Replace(userSession.ToCacheKey(), userSession, userSession.ExpiryDate.Value);
     }
 }