private async Task <GateInInstructions> GetValueSimulatingTypicalWebserviceCall(IEnumerable <string> scan)
        {
            using (var client = new BackendClient().Connect())
            {
                var bar        = scan.Aggregate(string.Empty, (current, next) => string.IsNullOrWhiteSpace(current) ? next : $"{current},{next}");
                var parameters = new[] { new KeyValuePair <string, string>(string.Empty, bar) };
                var content    = new FormUrlEncodedContent(parameters);

                var response = client.PostAsync(Settings.Default.ScanRoute, content).Result;

                if (!response.IsSuccessStatusCode)
                {
                    throw new IOException("Keine Verbindung zum SAP Backend");
                }

                if (response.StatusCode == HttpStatusCode.NoContent)
                {
                    return(null);
                }

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    throw new HttpRequestException($"Unbekannter StatusCode {response.StatusCode}");
                }

                var contents = await response.Content.ReadAsStringAsync();

                return(await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <GateInInstructions>(contents)));
            }
        }
        public async Task <bool> ShouldLockClientAsync()
        {
            try
            {
                using (var client = new BackendClient().Connect())
                {
                    var response = await client.GetAsync(Settings.Default.StatusRoute);

                    if (!response.IsSuccessStatusCode)
                    {
                        throw new IOException("Keine Verbindung zum SAP Backend");
                    }

                    return(await response.Content.ReadAsAsync <bool>());
                }
            }
            catch (Exception)
            {
                return(await Task.FromResult(true));
            }
        }