private static async Task GetAPIToken(string userName, string password, string apiBaseUri)
        {
            using (var client = new HttpClient())
            {
                //setup client
                client.BaseAddress = new Uri(apiBaseUri);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                //setup login data
                var formContent = new FormUrlEncodedContent(new[]
                 {
                 new KeyValuePair<string, string>("grant_type", "password"), 
                 new KeyValuePair<string, string>("username", userName), 
                 new KeyValuePair<string, string>("Password", password), 
                 });

                //send request
                
                HttpResponseMessage responseMessage =  client.PostAsync("/api/Token", formContent).Result;

                //get access token from response body
                var responseJson = responseMessage.Content.ReadAsStringAsync().Result;
                Debug.WriteLine("JSON:" + responseJson);
                var jObject = JObject.Parse(responseJson);
                return jObject.GetValue("access_token").ToString();
            }
        }