//Method to post Json data.
        private static async Task <StatusAndResponseClass> JsonPostData(string url, string strJsondata)
        {
            System.Diagnostics.Debug.WriteLine("CreateAboutSuggestion sending on server   : " + strJsondata);
            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Add("x-li-format", "json");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json;");
            StringContent       queryString = new StringContent(strJsondata, UTF8Encoding.UTF8, "application/json");
            HttpResponseMessage response    = await client.PostAsync(new Uri(url), queryString);

            //response.EnsureSuccessStatusCode();
            HttpStatusCode statuscode   = response.StatusCode;
            string         responseBody = await response.Content.ReadAsStringAsync();

            StatusAndResponseClass getResponse = new StatusAndResponseClass();

            if (response.IsSuccessStatusCode)
            {
                getResponse.responseString = responseBody;
            }
            else
            {
                getResponse.responseString = responseBody;
            }
            getResponse.statusCode = Convert.ToInt32(statuscode);
            return(getResponse);
        }
        /// <summary>
        /// Method to publish comment
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="comment"></param>
        public async static void PublishComment(string accessToken, string comment)
        {
            try
            {
                var requestUrl = String.Format(linkedinSharesEndPoint, accessToken);
                var shareMsg   =
                    new
                {
                    comment    = comment,
                    visibility = new { code = "anyone" }
                };

                var requestJson = JsonConvert.SerializeObject(shareMsg);
                StatusAndResponseClass response = await TSGLinkedInManager.JsonPostData(LinkedInCredential.PostLinkedInMessageURl(LinkedInCredential.LinkedInAccessToken), requestJson);

                if (response.statusCode == 200 || response.statusCode == 201)
                {
                    await new MessageDialog("Post published successfully.").ShowAsync();
                }
                else if (response.statusCode == 400)
                {
                    // For Duplicate messaage
                    await new MessageDialog("Do not post duplicate content").ShowAsync();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception Occur PostLinkedInNetworkUpdate() LinkedInHelper : " + ex.ToString());
            }
        }
        //Method to get UserInfo data
        public static async Task <StatusAndResponseClass> GetConfirmation(string url)
        {
            StatusAndResponseClass getResponse = new StatusAndResponseClass();
            HttpClient             httpClient  = new HttpClient();

            httpClient.DefaultRequestHeaders.Add("User-Agent", "WindowsApp");
            httpClient.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
            httpClient.DefaultRequestHeaders.Add("Pragma", "no-cache");
            httpClient.MaxResponseContentBufferSize         = int.MaxValue;
            httpClient.DefaultRequestHeaders.ExpectContinue = false;
            // By default, LinkedIn returns XML, we can get JSON instead by adding the header below
            httpClient.DefaultRequestHeaders.Add("x-li-format", "json");
            var httpRequestMessage = new HttpRequestMessage
            {
                Method     = HttpMethod.Get,
                RequestUri = new Uri(url)
            };
            var response = await httpClient.SendAsync(httpRequestMessage);

            // response.EnsureSuccessStatusCode();
            HttpStatusCode statuscode   = response.StatusCode;
            string         responseBody = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                getResponse.responseString = responseBody;
            }
            else
            {
                getResponse.responseString = responseBody;
            }
            getResponse.statusCode = Convert.ToInt32(statuscode);
            return(getResponse);
        }
        /// <summary>
        /// Method to publish comment with content
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="comment"></param>
        /// <param name="title"></param>
        /// <param name="submittedUrl"></param>
        /// <param name="submittedImageUrl"></param>
        /// <param name="description"></param>
        public async static void PublishCommentandContent(string accessToken, string comment, string title, string submittedUrl, string submittedImageUrl, [Optional] string description)
        {
            try
            {
                var requestUrl = String.Format(linkedinSharesEndPoint, accessToken);
                var shareMsg   =
                    new
                {
                    comment = comment,
                    content =
                        new
                    {
                        title               = title,
                        submitted_url       = submittedUrl,      // "http://www.bigcode.net",
                        submitted_image_url = submittedImageUrl, //"http://2.bp.blogspot.com/-8r_lWT_32lQ/TxrQW12ngPI/AAAAAAAAI70/ifMF4Z16M-Y/s1600/SQL+Server+session+state.png",
                        description         = description
                    },
                    visibility = new { code = "anyone" }
                };

                var requestJson = JsonConvert.SerializeObject(shareMsg);
                StatusAndResponseClass response = await TSGLinkedInManager.JsonPostData(LinkedInCredential.PostLinkedInMessageURl(LinkedInCredential.LinkedInAccessToken), requestJson);

                if (response.statusCode == 200 || response.statusCode == 201)
                {
                    await new MessageDialog("Post published successfully.").ShowAsync();
                }
                else if (response.statusCode == 400)
                {
                    // For Duplicate messaage
                    await new MessageDialog("Do not post duplicate content").ShowAsync();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception Occur PostLinkedInNetworkUpdate() LinkedInHelper : " + ex.ToString());
            }
        }