private async Task RunDownloadParallelAsync(IProgress <ProgressModel> progress, ParallelOptions parallelOption)
        {
            var websites = SiteData();
            int count    = 1;


            ProgressModel model = new ProgressModel();

            await Task.Run(() => {
                try {
                    ParallelLoopResult result = Parallel.ForEach <string>(websites, parallelOption, (site, loopState) => {
                        if (parallelOption.CancellationToken.IsCancellationRequested)
                        {
                            this.Dispatcher.Invoke(() => {
                                resultsWindow.Text += $"The download was cancelled : {Environment.NewLine}";
                            });

                            return;
                        }

                        if (loopStatus == "stop")
                        {
                            loopState.Stop();
                            return;
                        }
                        else if (loopStatus == "break")
                        {
                            loopState.Break();
                            return;
                        }

                        var results = DownloadWebsite(site);

                        model.PercentageComplete = (count * 100) / websites.Count;
                        progress.Report(model);
                        count++;

                        this.Dispatcher.Invoke(() => {
                            resultsWindow.Text += $"{results.WebsiteUrl} downloaded: {results.WebsiteData.Length}" +
                                                  $" characters long. {Environment.NewLine}";
                        });
                    });

                    if (result.IsCompleted)
                    {
                        this.Dispatcher.Invoke(() => {
                            resultsWindow.Text += "Stack ran to completion" + $" {Environment.NewLine}";
                        });
                    }
                    else if (result.IsCompleted == false && result.LowestBreakIteration == null)
                    {
                        //Loop exited prematurely by Stop()
                        this.Dispatcher.Invoke(() => {
                            resultsWindow.Text += "Stack exited by Stop()." + $" {Environment.NewLine}";
                            loopStatus          = "non";
                        });
                    }
                    else if (result.IsCompleted == false && result.LowestBreakIteration != null)
                    {
                        //Loop exited by Break()
                        this.Dispatcher.Invoke(() => {
                            resultsWindow.Text += "Stack exited by Break()." + $"{Environment.NewLine}";
                            loopStatus          = "non";
                        });
                    }
                } catch (OperationCanceledException) {
                    this.Dispatcher.Invoke(() => {
                        resultsWindow.Text += $"The download was cancelled : {Environment.NewLine}";
                    });
                } finally {
                    cts.Dispose();
                    cts = new CancellationTokenSource();
                }
            });
        }
 private void ReportProgress(object sender, ProgressModel e)
 {
     executeProgress.Value = e.PercentageComplete;
 }