public static void UploadImage()
        {
            Properties.Settings.Default.message = "Uploading file.";

            Task <string> responseContent = UploadImage(ImgHelper.GetImgPath());

            if (responseContent == null)
            {
                return;
            }

            responseContent.Wait();

            string json = responseContent.Result;

            ResponseJson responseObj = JsonConvert.DeserializeObject <ResponseJson>(json);

            if (responseObj.Status == "success")
            {
                bool parsed = Int32.TryParse(responseObj.SubId, out int parseResult);

                if (parsed)
                {
                    ApiHelper.SubId = parseResult;
                }
            }
        }
        private static async Task <string> UploadImage(string path)
        {
            string url = $"upload";

            using (var content = new MultipartFormDataContent())
            {
                //firstPart
                RequestJson fits = new RequestJson()
                {
                    session = ApiHelper.SessionKey
                };
                string jsonString = JsonConvert.SerializeObject(fits);
                var    firstPart  = new StringContent(jsonString, Encoding.UTF8, "application/json");

                //secondPart
                byte[] img = null;
                try
                {
                    img = ImgHelper.ImgToByteArray(path);
                }
                catch
                {
                    Properties.Settings.Default.message = "File not found.";
                    return(null);
                }


                content.Add(firstPart, "request-json");
                content.Add(new StreamContent(new MemoryStream(img)), "file", "file.fit");


                using (HttpResponseMessage response
                           = await ApiHelper.ApiClient.PostAsync(url, content).ConfigureAwait(false))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        string responseContent = await response.Content.ReadAsStringAsync();

                        return(responseContent);
                    }
                    else
                    {
                        throw new Exception(response.ReasonPhrase);
                    }
                }
            }
        }