public async Task LoginAsAsync(int userId)
        {
            using (UserDefinitionDataProvider dataProvider = new UserDefinitionDataProvider()) {
                UserDefinition user = await dataProvider.GetItemByUserIdAsync(userId);

                if (user == null)
                {
                    throw new Error(this.__ResStr("noUser", "User with id {0} doesn't exist", userId));
                }
                if (user.UserStatus != UserStatusEnum.Approved)
                {
                    throw new Error(this.__ResStr("notApproved", "User account for user {0} has not been approved - can't log in", user.UserName));
                }
                await LoginModuleController.UserLoginAsync(user);
            }
        }
 public async Task LogoffAsync()
 {
     await LoginModuleController.UserLogoffAsync();
 }