public async Task <FrameNumberImage> RegisterImage(string userName, string token, string uuid, FrameNumberImage frameNumberImage, bool deleteImage)
        {
            if (uuid == "" || frameNumberImage == null)
            {
                return(new FrameNumberImage());
            }

            FrameNumberImageResponse response = await awsHttpClient.RegisterImage(new FrameNumberImageRequest()
            {
                Username = userName, Token = token, UID = uuid, FrameNumberImage = frameNumberImage, DeleteImage = deleteImage
            });

            if (response == null || response?.FrameNumberImage == null)
            {
                return(new FrameNumberImage()); // empty
            }
            return(response.FrameNumberImage);
        }
        public async Task <FrameNumberImage> RegisterImage(string userName, string token, string uuid, FrameNumberImage frameNumberImage, bool deleteImage)
        {
            if (uuid == "" || frameNumberImage == null)
            {
                return(new FrameNumberImage());
            }

            if (client.DefaultRequestHeaders.Contains("code"))
            {
                client.DefaultRequestHeaders.Remove("code");
            }
            client.DefaultRequestHeaders.Add("code", Constants.AzureApiKey_RegisterImage);

            try
            {
                string postBody = JsonConvert.SerializeObject(new FrameNumberImageRequest()
                {
                    Username = userName, Token = token, UID = uuid, FrameNumberImage = frameNumberImage, DeleteImage = deleteImage
                });

                HttpResponseMessage response = await client.PostAsync(Constants.AzureEndPoint_RegisterImage, new StringContent(postBody, Encoding.UTF8, "application/json"));

                if (response.IsSuccessStatusCode)
                {
                    string str = await response.Content.ReadAsStringAsync();

                    //     AnalyticsService.TrackEvent(str);
                    var settings = new JsonSerializerSettings
                    {
                        NullValueHandling     = NullValueHandling.Ignore,
                        MissingMemberHandling = MissingMemberHandling.Ignore
                    };
                    FrameNumberImageResponse frameNumberImageResponse = JsonConvert.DeserializeObject <FrameNumberImageResponse>(str, settings);
                    if (frameNumberImageResponse == null || frameNumberImageResponse?.FrameNumberImage == null)
                    {
                        return(new FrameNumberImage()); // empty
                    }
                    return(frameNumberImageResponse.FrameNumberImage);
                }
                else
                {
                    string str = await response.Content.ReadAsStringAsync();

                    AnalyticsService.TrackEvent(str);
                }
            }
            catch (HttpRequestException hre)
            {
                AnalyticsService.TrackError(hre);
            }
            catch (TaskCanceledException hca)
            {
                AnalyticsService.TrackError(hca);
                AnalyticsService.TrackEvent("Request canceled");
            }
            catch (Exception ex)
            {
                AnalyticsService.TrackError(ex);
            }
            finally
            {
                /*if (httpClient != null)
                 * {
                 *  httpClient.Dispose();
                 *  httpClient = null;
                 * }*/
            }

            return(new FrameNumberImage());
        }