protected override async Task SyncAsync()
        {
            // Loop.
            foreach (var gameList in this.Catalog.GameLists)
            {
                if (this.Cancel)
                {
                    break;
                }

                NotifyProgress(this.Progress, "Syncing " + gameList.Platform.ToDisplayString() + "\n");
                this.Index++;

                string devicePlatformPath = Path.Combine(this.Device.RomsPath, Path.GetFileName(gameList.PlatformFolderPath));
                if (this.Device.SyncPlatform(gameList.Platform))
                {
                    await this.AccessProvider.EnsureFolderExistsAsync(devicePlatformPath);

                    string deviceImageFolderPath = await this.AccessProvider.EnsureFolderExistsAsync(devicePlatformPath,
                                                                                                     GameList.ImagesFolderName);
                    await ProcessDeviceFilesAsync(devicePlatformPath, deviceImageFolderPath, gameList);
                    await PushGameFilesToDeviceAsync(devicePlatformPath, deviceImageFolderPath, gameList);

                    await this.AccessProvider.CopyFileAsync(gameList.FilePath, GameList.GetFilePath(devicePlatformPath));
                }
                else if (await this.AccessProvider.FolderExistsAsync(devicePlatformPath))
                {
                    await this.AccessProvider.DeleteFolderContentsAsync(devicePlatformPath);
                }
            }

            // Write the Emulators config file.
            WriteEmulatorsConfigFile();

            // Update the device.
            this.Device.LastSyncedDate = DateTime.UtcNow;
            await this.Catalog.Config.SaveAsync();

            // Notify complete.
            base.NotifySyncComplete(this.Progress);
        }
        private async Task UpdateCatalogGameListsAsync(DeviceConfig deviceConfig)
        {
            NotifyProgress(this.Progress, "Updating Catalog Game Lists\n");

            foreach (string folderPath in await this.AccessProvider.GetFolderPathsAsync(deviceConfig.RomsFolderPath))
            {
                if (this.Cancel)
                {
                    break;
                }

                string platformFolderName = Path.GetDirectoryName(folderPath);
                var    platform           = GameList.GetPlatform(platformFolderName);

                if (platform.HasValue)
                {
                    if (deviceConfig.Device.SyncPlatform(platform.Value))
                    {
                        string sourcePath = GameList.GetFilePath(Path.Combine(deviceConfig.CatalogFolderPath, platformFolderName));
                        string destPath   = GameList.GetFilePath(folderPath);

                        if (await this.AccessProvider.IsNewerCopyRequiredAsync(sourcePath, destPath))
                        {
                            NotifyProgress(this.Progress, " - Downloading " + Path.GetFileName(sourcePath) + " for " + platformFolderName + "\n");
                            await this.AccessProvider.CopyFileAsync(sourcePath, destPath);
                        }
                    }
                    else
                    {
                        NotifyProgress(this.Progress, " - Removing files for " + platformFolderName + "\n");
                        FileSystemHelper.DeleteFolderContents(folderPath);
                    }
                }
            }

            // Reload the catalog.
            this.Catalog = new Catalog(this.Catalog.Config);
        }