public async Task <SubscriptionOverview> GetSubscriptionsAsync(CancellationToken cancellationToken, IMachineStateService machineStateService)
        {
            async Task GetMachineState(SubscriptionOverview subscriptionOverview)
            {
                var tasks = (
                    from subscription in subscriptionOverview.Subscriptions
                    from assignedMachine in subscription.AssignedMachines
                    select Task.Run(async() =>
                {
                    var machineState =
                        await machineStateService.GetMachineStateAsync(assignedMachine.Id, cancellationToken);
                    assignedMachine.MachineState =
                        machineState.HasValues ? Models.MachineState.Running : Models.MachineState.Offline;
                }, cancellationToken)).ToList();
                await Task.WhenAll(tasks);
            }

            var token = await _tokenProvider.ReceiveTokenAsync(TapioScope.GlobalDiscovery);

            var request = new HttpRequestMessage(HttpMethod.Get, new Uri($"{TargetUrl}{TargetRoute}{WebUtility.UrlEncode(_tapioEmail)}"));

            request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
            var responseMessage = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);

            responseMessage.EnsureSuccessStatusCode();
            var content = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);

            var result = SubscriptionOverviewExtension.FromJson(content);

            await GetMachineState(result);

            return(result);
        }
        public async Task <SubscriptionOverview> GetSubscriptionAsync(CancellationToken cancellationToken)
        {
            var token = await _tokenProvider.ReceiveTokenAsync(cancellationToken);

            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, _globalDiscoSubscriptionOverviewRequest);

            request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
            var responseMessage = await _httpClient.SendAsync(request, cancellationToken);

            responseMessage.EnsureSuccessStatusCode();
            var content = await responseMessage.Content.ReadAsStringAsync();

            var result = SubscriptionOverviewExtension.FromJson(content);

            return(result);
        }