public void OnCreateAndUploadImage(object obj)
        {
            EA.GetEvent<SetCompositionWidthHeight>().Publish(string.Empty);

            var document = HtmlPage.Document;
            var txtArea = document.GetElementById("MainContent_txtPNGBytes");

            if (txtArea != null)
            {
                try
                {
                    const double scale = 1;

                    var bmp = new WriteableBitmap(CompositionGrid, null);
                    var buffer = bmp.ToByteArray();

                    bmp = new WriteableBitmap(int.Parse(Width.ToString()), int.Parse(Height.ToString()));
                    bmp.FromByteArray(buffer);

                    var transform = new ScaleTransform();
                    transform.ScaleX = scale;
                    transform.ScaleY = scale;

                    bmp.Render(CompositionGrid, (Transform)transform);
                    bmp.Invalidate();

                    var stream = bmp.GetStream();
                    var binaryData = new Byte[stream.Length];
                    var bytesRead = stream.Read(binaryData, 0, (int)stream.Length);
                    var base64 = Convert.ToBase64String(binaryData, 0, binaryData.Length);

                    RawSize = base64.Length.ToString();
                    Message message = Composer.Messaging.Compression.Compress(base64);
                    base64 = message.Text;
                    CompressedSize = base64.Length.ToString();
                    txtArea.SetProperty("value", base64);

                    UploadDetailsVisibility = Visibility.Visible;

                    SendImage();
                }
                catch (Exception ex)
                {
                    Exceptions.HandleException(ex, "Error in: OnCreateAndUploadImage");
                }
            }
        }