internal static string LoginUser(string username, string authenticationCode)
        {
            ValidateUsername(username);
            ValidateAuthCode(authenticationCode);

            var userModel = new UserModel()
            {
                Username = username,
                AuthCode = authenticationCode
            };
            var loginResponse = HttpRequester.Post<LoginResponseModel>(BaseServicesUrl + "auth/token",
                userModel);
            AccessToken = loginResponse.AccessToken;
            return loginResponse.Username;
        }
        internal static void RegisterUser(string username, string displayName, string email, 
            string phone, string location, string authenticationCode)
        {
            ValidateUsername(username);
            ValidateEmail(email);
            ValidateAuthCode(authenticationCode);

            var userModel = new UserModel()
            {
                Username = username,
                DisplayName = displayName,
                Mail = email,
                Phone = phone,
                Location = location,
                AuthCode = authenticationCode
            };
            HttpRequester.Post(BaseServicesUrl + "users/register",
                userModel);
        }
 private static void ValidateUser(UserModel userModel)
 {
     if (userModel == null)
     {
         throw new FormatException("Username and/or password are invalid");
     }
     ValidateUsername(userModel.Username);
     ValidateAuthCode(userModel.AuthCode);
 }