void OnUserActivity(string userId)
 {
     lock (_locker)
     {
         UserStatus userStatus;
         if (_userStatuses.ContainsKey(userId))
         {
             userStatus = _userStatuses[userId];
         }
         else
         {
             userStatus = new UserStatus();
             _userStatuses.Add(userId, userStatus);
         }
         var oldStatus = userStatus.Status;
         userStatus.Status = UserOnlineStatus.Online;
         userStatus.LastActivity = DateTime.Now;
         if (oldStatus != userStatus.Status)
         {
             _events.GetEvent<UserOnlineStatusChangedEvent>().Publish(new UserStatusEventArgs
             {
                 UserUuid = userId,
                 Status = userStatus.Status
             });
         }
     }
 }
        public void RegisterUser(string userUuid)
        {
            Task.Factory.StartNew(() =>
                {
                    lock (_locker)
                    {
                        UserStatus userStatus;
                        if (_userStatuses.ContainsKey(userUuid))
                        {
                            userStatus = _userStatuses[userUuid];
                        }
                        else
                        {
                            userStatus= new UserStatus();
                            _userStatuses.Add(userUuid, userStatus);
                        }

                        _events.GetEvent<UserOnlineStatusChangedEvent>().Publish(new UserStatusEventArgs
                        {
                            UserUuid = userUuid,
                            Status = userStatus.Status
                        });

                    }
                });
        }