/// <summary>
        /// Handles the Click event of the btnExportData control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnExportData_Click(object sender, EventArgs e)
        {
            string backupFilename = "GalleryServerBackup_" + DateTime.Now.ToString("yyyy-MM-dd_HHmmss", CultureInfo.InvariantCulture);

            IBackupFile bak = new BackupFile();

            bak.IncludeMembershipData = chkExportMembership.Checked;
            bak.IncludeGalleryData = chkExportGalleryData.Checked;

            var galleryData = bak.Create();

            IMimeType mimeType = Factory.LoadMimeType("dummy.zip");

            int bufferSize = AppSetting.Instance.MediaObjectDownloadBufferSize;
            byte[] buffer = new byte[bufferSize];

            Stream stream = null;
            try
            {
                // Create an in-memory ZIP file.
                stream = ZipUtility.CreateZipStream(galleryData, backupFilename + ".xml");

                // Send to user.
                Response.AddHeader("Content-Disposition", "attachment; filename=" + backupFilename + ".zip");

                Response.Clear();
                Response.ContentType = (mimeType != null ? mimeType.FullType : "application/octet-stream");
                Response.Buffer = false;

                stream.Position = 0;
                int byteCount;
                while ((byteCount = stream.Read(buffer, 0, buffer.Length)) > 0)
                {
                    if (Response.IsClientConnected)
                    {
                        Response.OutputStream.Write(buffer, 0, byteCount);
                        Response.Flush();
                    }
                    else
                    {
                        return;
                    }
                }
            }
            finally
            {
                if (stream != null)
                    stream.Close();

                Response.End();
            }
        }