public IUser Login(string userName, string password, string tokenName, out IToken token)
        {
            IUser user = this.userService.GetUser(userName);
            if (user == default(IUser))
            {
                throw new NotFoundException();
            }
            if (!user.IsPasswordValid(password))
            {
                throw new UnauthorizedException("Password invalid.");
            }

            token = new Token(tokenName, TokenType.Authentication);
            this.userService.AddToken(user.GetUserGuid(), token);
            return user;
        }
        public IUser Register(string userName, string password, string tokenName, out IToken token)
        {
            IUser user = this.userService.GetUser(userName);
            if (user == default(IUser))
            {
                user = new User(userName, string.Empty).SetPassword(password);
                this.userService.PutUser(user);
            }
            else if (!user.IsPasswordValid(password))
            {
                throw new ConflictException("User exists.  Password invalid.");
            }

            token = new Token(tokenName, TokenType.Authentication);
            this.userService.AddToken(user.GetUserGuid(), token);
            return user;
        }