public async Task <LoyaltyProgramUser> UpdateUser(LoyaltyProgramUser user)
        {
            using (var client = InitializeClient())
            {
                client.BaseAddress = new Uri(Address);
                var response = await client.PutAsync($"/users/{user.Id}",
                                                     new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, MediaTypeInRequests));

                return(JsonConvert.DeserializeObject <LoyaltyProgramUser>(await response.Content.ReadAsStringAsync()));
            }
        }
        public async Task <LoyaltyProgramUser> RegisterUser(LoyaltyProgramUser newUser)
        {
            using (var client = InitializeClient())
            {
                client.BaseAddress = new Uri(Address);

                var response = await client.PostAsync("/users/",
                                                      GetStringContentFromObject(newUser));

                return(JsonConvert.DeserializeObject <LoyaltyProgramUser>(await response.Content.ReadAsStringAsync()));
            }
        }
 private static StringContent GetStringContentFromObject(LoyaltyProgramUser newUser)
 {
     return(new StringContent(JsonConvert.SerializeObject(newUser), Encoding.UTF8, MediaTypeInRequests));
 }