private void btnFindFace_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new OpenFileDialog();

            if (!dlg.ShowDialog().Value)
            {
                return;
            }

            string path = dlg.FileName;

            // Process image

            ImageRecognitionAndProcessingClient client = new ImageRecognitionAndProcessingClient();

            System.Drawing.Image outcome = client.CropToFirstFace(path);

            var response = client.LocateFaces(File.ReadAllBytes(path));

            txtOutput.Text = JsonConvert.SerializeObject(response);


            var imageSourceConverter = new ImageSourceConverter();

            byte[]      tempBitmap = BitmapToByte((System.Drawing.Bitmap)outcome);
            ImageSource image      = (ImageSource)imageSourceConverter.ConvertFrom(tempBitmap);


            imgOutput.Source = image;

            // Log success

            CloudmersiveAuditClient client2 = new CloudmersiveAuditClient();

            AuditLogWriteRequest req = new AuditLogWriteRequest();

            req.AuditLogMessage     = "Successfully processed image.";
            req.AuditLogReferenceIP = GetLocalIPAddress();
            req.AuditLogMeta        = dlg.FileName;

            CloudmersiveValidationApiClient valid = new CloudmersiveValidationApiClient();
            var geo = valid.GeolocateIP(req.AuditLogReferenceIP);

            req.AuditLogReferenceLocation = JsonConvert.SerializeObject(geo);

            client2.WriteLogMessageFull(req);
        }
        public AuditLogResponse WriteLogMessageFull(AuditLogWriteRequest req)
        {
            using (WebClient client = new WebClient())
            {
                client.Headers.Add("Apikey", Apikey);
                client.Headers[HttpRequestHeader.ContentType] = "application/json";



                var bytes = System.Text.Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(req));

                var response = client.UploadData("https://api.cloudmersive.com/audit/log/write-message-full", "POST", bytes);

                string result = System.Text.Encoding.ASCII.GetString(response);



                return(JsonConvert.DeserializeObject <AuditLogResponse>(result));
            }
        }