private void menuExportCurrentEntries_Click(object sender, RoutedEventArgs e)
        {
            IList <NuixLogEntry> currentEntries = resultsGrid.CurrentLogEntries;

            if (currentEntries == null || currentEntries.Count < 1)
            {
                MessageBox.Show("There are no log entries to export!");
                return;
            }

            Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
            sfd.Title = "Select Output Log File";
            // TODO: Might be a more useful default suggested file name?
            sfd.FileName = "NuixLogSubset.log";
            sfd.Filter   = "Log File (*.log)|*.log";
            if (sfd.ShowDialog() == true)
            {
                IsBusy = true;

                ProgressBroadcaster pb = new ProgressBroadcaster();
                pb.StatusUpdated += (statusMessage) =>
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        lblStatus.Text = statusMessage;
                    }));
                };
                pb.ProgressUpdated += (progress) =>
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        lblProgress.Text = progress.ToString("###,###,##0");
                    }));
                };

                pb.BroadcastStatus("Exporting log entries to: " + sfd.FileName);

                Task exportTask = new Task(() =>
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName))
                    {
                        for (int i = 0; i < currentEntries.Count; i++)
                        {
                            pb.BroadcastProgress(i + 1);
                            NuixLogEntry entry = currentEntries[i];
                            sw.WriteLine(entry.ToLogLine());
                        }
                    }

                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        IsBusy = false;
                    }));
                });

                exportTask.Start();
            }
        }
        /// <summary>
        /// Loads a series of log files into the repo for searching and review.
        /// </summary>
        /// <param name="filesToLoad">Array of absolute log file paths.</param>
        private void loadLogFiles(string[] filesToLoad)
        {
            if (filesToLoad.Length > 0)
            {
                lblStatus.Text = "Loading log files...";
                IsBusy         = true;
                Task loadFilesTask = new Task(() =>
                {
                    ProgressBroadcaster pb = new ProgressBroadcaster();
                    pb.StatusUpdated      += (statusMessage) =>
                    {
                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            lblStatus.Text = statusMessage;
                        }));
                    };
                    pb.ProgressUpdated += (progress) =>
                    {
                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            lblProgress.Text = progress.ToString("###,###,##0");
                        }));
                    };

                    repo.LoadLogFiles(filesToLoad, pb);

                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        txtSearchQuery.Text  = "";
                        flagList.ItemsSource = repo.Database.GetAllFlags();
                        // IsBusy will be cleared by performSearch()
                        performSearch();
                    }));
                });
                loadFilesTask.Start();
            }
        }