private static void DoCompactAndRepair(string currentPath, string dbName, string tempName, string repairedName, bool isTestingRun)
        {
            Access.Application oAccess = null;

            try
            {
                string originalDbPath = Path.Combine(currentPath, dbName);
                string tempOiginalDbPath = Path.Combine(currentPath, tempName);
                string compactedRepairedDbPath = Path.Combine(currentPath, repairedName);

                if (File.Exists(compactedRepairedDbPath) || File.Exists(tempOiginalDbPath))
                {
                    throw new IOException(
                        string.Format("It appears that a previous compact and repair did not complete successfully for {0}.",
                            originalDbPath) +
                        " Notify Rich of the issue.");
                }

                if (isTestingRun)
                {
                    Console.WriteLine();
                    Console.WriteLine("Testing Run - no actual compact and repair performed. {0}", originalDbPath);
                }
                else
                {
                    Task taskCompactRepair = new Task(() =>
                    {
                        oAccess = new Access.Application();
                        oAccess.CompactRepair(originalDbPath, compactedRepairedDbPath, true);
                        System.Threading.Thread.Sleep(600);
                    });

                    taskCompactRepair.Start();

                    while (!taskCompactRepair.IsCompleted)
                    {
                        System.Threading.Thread.Sleep(200);
                        Console.Write(".");
                    }
                    Console.WriteLine();
                    taskCompactRepair.Wait();

                    if (!File.Exists(compactedRepairedDbPath))
                    {
                        throw new FileNotFoundException(
                            string.Format("Compact and repair failed to create the repaired database. {0}",
                                compactedRepairedDbPath));
                    }

                    File.Move(originalDbPath, tempOiginalDbPath);
                    File.Move(compactedRepairedDbPath, originalDbPath);
                    File.Delete(tempOiginalDbPath);
                }
            }
            finally
            {
                try
                {
                    if (oAccess != null)
                    {
                        oAccess.Quit();
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("There may have been a problem doing compact and repair.");
                }
            }
        }