/// <summary>
        /// Adds report to the list of report used for reporting purposes.
        /// </summary>
        /// <param name="_reportType">The type of report that needs to be created</param>
        public void CreateReport(ReportingType _reportType)
        {
            switch (_reportType)
            {
            case ReportingType.KpaOverall:
                // Create the KPA Overall Report
                try
                {
                    reports.Add(_reportType, KpaOverallReport.KpaOverallReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPA Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPA Overall Report
                    KpaOverallReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpaOverall] = KpaOverallReport.KpaOverallReportInstance;
                }
                break;

            case ReportingType.KpiOverall:
                // Create the KPI Overall Report
                try
                {
                    reports.Add(_reportType, KpiOverallReport.KpiOverallReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPI Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPI Overall Report
                    KpiOverallReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpiOverall] = KpiOverallReport.KpiOverallReportInstance;
                }
                break;

            case ReportingType.KpaComparisonReport:
                // Create the KPA Report
                try
                {
                    reports.Add(_reportType, KpaComparisonReport.KpaComparisonReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPA Comparison Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPI Overall Report
                    KpaComparisonReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpaComparisonReport] = KpaComparisonReport.KpaComparisonReportInstance;
                }
                break;

            case ReportingType.KpiComparisonReport:
                // Create the KPI Report
                try
                {
                    reports.Add(_reportType, KpiComparisonReport.KpiComparisonReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPI Comparison Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPI Overall Report
                    KpiComparisonReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpiComparisonReport] = KpiComparisonReport.KpiComparisonReportInstance;
                }
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// Event listener for when the user wants to generate a Comparison report
        /// </summary>
        /// <param name="sender">The Generate report button</param>
        /// <param name="e">The click event</param>
        private async void ComparisonReportGeneration(object sender, EventArgs e)
        {
            switch (reportingWidgetsController.ComparisonReportingType)
            {
            case ReportingType.KpaComparisonReport:
                // Create the comparison report
                CreateReport(ReportingType.KpaComparisonReport);
                KpaComparisonReport kpaComparisonReport = (reports[ReportingType.KpaComparisonReport] as KpaComparisonReport);

                // The user wants to create a KPA Comparison Report.
                Task <bool> kpaComparisonReportTask = new Task <bool>(GenerateKpaComparisonReport);
                kpaComparisonReportTask.Start();

                if (await kpaComparisonReportTask)
                {
                    ActivateLoadingScreen("Loading Report...");

                    // The report has finished creating now run it.
                    Task calculateComparisonReportTask = new Task(() => { kpaComparisonReport.RunReport(reportingWidgetsController.ComparisonFilterOption); });
                    calculateComparisonReportTask.Start();
                    await calculateComparisonReportTask;

                    // Beging to export the comparison report to excel.
                    Task comparisonReportExport = new Task(() =>
                    {
                        ComparisonReportExcelFile xlFile = new ComparisonReportExcelFile(kpaComparisonReport.TemplateStructure)
                        {
                            Filter  = FilterOptions.options[(int)reportingWidgetsController.ComparisonFilterOption],
                            Country = ReportingCountry.countries[(int)ReportingCountry.TargetCountry],
                            ReportGenerationDate = $"{DateTime.Now:D}"
                        };

                        Exporter xporter = new Exporter();
                        xporter.ExportComparisonReport(xlFile);
                    });
                    comparisonReportExport.Start();

                    // Wait for the report to finish exporting
                    await comparisonReportExport;

                    // Hide any pages that might be visible
                    HidePages();

                    // Unclock the navigation and the menu strip.
                    navigationSettings.Status       = Navigation.Functionality.Unlocked;
                    ms_applicaitonMenuStrip.Enabled = true;
                }
                else
                {
                    // The report did not successfully create
                    MessageBox.Show("The report failed to generate!", "KPA Comparison Report Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            case ReportingType.KpiComparisonReport:
                // Create the comparison report
                CreateReport(ReportingType.KpiComparisonReport);
                KpiComparisonReport kpiComparisonReport = (reports[ReportingType.KpiComparisonReport] as KpiComparisonReport);

                // The user wants to create a KPI Comparison Report.
                Task <bool> kpiComparisonReportTask = new Task <bool>(GenerateKpiComparisonReport);
                kpiComparisonReportTask.Start();

                if (await kpiComparisonReportTask)
                {
                    ActivateLoadingScreen("Loading Report...");

                    // Start loading the KPI table and wait for the table to finish loading before running the comparison report.
                    Task kpaTableTask = new Task(DatabaseManager.LoadKPITables);
                    kpaTableTask.Start();
                    await kpaTableTask;

                    // The report has finished creating now run it.
                    Task calculateComparisonReportTask = new Task(() => { kpiComparisonReport.RunReport(reportingWidgetsController.ComparisonFilterOption); });
                    calculateComparisonReportTask.Start();
                    await calculateComparisonReportTask;

                    // Beging to export the comparison report to excel.
                    Task comparisonReportExport = new Task(() =>
                    {
                        ComparisonReportExcelFile xlFile = new ComparisonReportExcelFile(kpiComparisonReport.TemplateStructure)
                        {
                            Filter  = FilterOptions.options[(int)reportingWidgetsController.ComparisonFilterOption],
                            Country = ReportingCountry.countries[(int)ReportingCountry.TargetCountry],
                            ReportGenerationDate = $"{DateTime.Now:D}"
                        };

                        Exporter xporter = new Exporter();
                        xporter.ExportComparisonReport(xlFile);
                    });
                    comparisonReportExport.Start();

                    // Wait for the report to finish exporting
                    await comparisonReportExport;

                    // Hide any pages that might be visible
                    HidePages();

                    // Unclock the navigation and the menu strip.
                    navigationSettings.Status       = Navigation.Functionality.Unlocked;
                    ms_applicaitonMenuStrip.Enabled = true;

                    // Release the KPI tables
                    DatabaseManager.ReleaseKPITables();
                }
                else
                {
                    // The report did not successfully create
                    MessageBox.Show("The report failed to generate!", "KPI Comparison Report Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            default:
                MessageBox.Show("Could not determine the type of comparison Report", "Comparison Report Failure");
                break;
            }
        }