private static async Task ProcessTaskAsync(Definitions.List.TaskInfo currentTask)
        {
            try
            {
                TmInfoUpdate();

                ActiveTask         = currentTask;
                currentTask.Active = true;

                switch (currentTask.TaskType)
                {
                default:
                    await currentTask.App.CopyFilesAsync(currentTask, CancellationToken.Token).ConfigureAwait(false);

                    break;

                case TaskType.Delete:
                    await currentTask.App.DeleteFilesAsync(currentTask).ConfigureAwait(false);

                    currentTask.App.Library.Apps.Remove(currentTask.App);
                    break;

                case TaskType.Compact:
                    await currentTask.App.CompactTask(currentTask, CancellationToken.Token).ConfigureAwait(false);

                    break;
                }

                if (!CancellationToken.IsCancellationRequested && !currentTask.ErrorHappened)
                {
                    if (currentTask.RemoveOldFiles && currentTask.TaskType != TaskType.Delete && currentTask.TaskType != TaskType.Compact)
                    {
                        Main.FormAccessor.TmLogs.Report(Framework.StringFormat.Format(SLM.Translate(nameof(Properties.Resources.TaskManager_RemoveOldFiles)), new { CurrentTime = DateTime.Now, currentTask.App.AppName }));
                        await currentTask.App.DeleteFilesAsync(currentTask).ConfigureAwait(false);

                        currentTask.App.Library.Apps.Remove(currentTask.App);
                        Main.FormAccessor.TmLogs.Report(Framework.StringFormat.Format(SLM.Translate(nameof(Properties.Resources.TaskManager_RemoveOldFilesCompleted)), new { CurrentTime = DateTime.Now, currentTask.App.AppName }));
                    }

                    if (currentTask.TargetLibrary?.Type == LibraryType.Steam)
                    {
                        _isRestartRequired = true;
                    }

                    currentTask.TaskStatusInfo = SLM.Translate(nameof(Properties.Resources.TaskStatus_Completed));
                    currentTask.Active         = false;
                    currentTask.Completed      = true;

                    currentTask.TargetLibrary?.UpdateAppList();

                    if (currentTask.AutoInstall && !currentTask.Compress)
                    {
                        while (currentTask.TargetLibrary.IsUpdatingAppList)
                        {
                            await Task.Delay(100);
                        }

                        switch (currentTask.TargetLibrary.Type)
                        {
                        case LibraryType.Steam:
                        case LibraryType.SLM:
                            // Not available
                            break;

                        case LibraryType.Origin:
                        case LibraryType.Uplay:
                            currentTask.TargetLibrary.Apps.First(x => x.AppId == currentTask.App.AppId && x.IsCompressed == currentTask.Compress)?.InstallAsync();
                            break;
                        }
                    }

                    // Update library details
                    if (Definitions.SLM.CurrentSelectedLibrary == currentTask.App.Library)
                    {
                        App.UpdateAppPanel(currentTask.App.Library);
                    }
                }

                if (TaskList.Count(x => !x.Completed) == 0)
                {
                    if (Properties.Settings.Default.PlayASoundOnCompletion)
                    {
                        if (!string.IsNullOrEmpty(Properties.Settings.Default.CustomSoundFile) && File.Exists(Properties.Settings.Default.CustomSoundFile))
                        {
                            using (var soundPlayer = new System.Media.SoundPlayer(Properties.Settings.Default.CustomSoundFile))
                            {
                                soundPlayer.Play();
                            }
                        }
                        else
                        {
                            System.Media.SystemSounds.Exclamation.Play();
                        }
                    }

                    if (_isRestartRequired && !Properties.Settings.Default.TaskManager_SteamRestartSkip)
                    {
                        Steam.RestartSteamAsync();
                        _isRestartRequired = false;
                    }
                }

                if (Properties.Settings.Default.TaskManager_AutoClear && !currentTask.ErrorHappened)
                {
                    RemoveTaskProgress.Report(currentTask);
                }

                SLM.Library.UpdateLibraryVisual();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                Logger.Fatal(ex);
            }
            finally
            {
                TmInfoUpdate();
            }
        }