private async Task Delete(PackageMessage message)
        {
            var task = new DeletePackageTask(notifier, support);

            // ReSharper disable RedundantArgumentName
            await ProcessPackage(
                message.UserInfo, message.FeedName, message.PackageName,
                PackageState.DeletingQueued, PackageState.DamagedDeleting,
                tryWithPackageItemBefore : async pi =>
            {
                Trace.TraceInformation("Deleting package {0}", pi);
                // ReSharper disable once ConvertToLambdaExpression
                return(await pi.Move(PackageState.Deleting, pi.Name));
            },
                tryWithPackage : async(pi, p) =>
            {
                await task.DeletePackage(message.UserInfo, pi.Feed, pi.Name, pi, p);
            }, tryWithPackageItemAfter : async pi =>
            {
                await pi.Delete();
                Trace.TraceInformation("Finished deleting package {0}", pi);
            });

            // ReSharper restore RedundantArgumentName
        }
        private async Task Retry(PackageMessage message)
        {
            var deleteTask = new DeletePackageTask(notifier, support);

            // ReSharper disable RedundantArgumentName
            if (!await ProcessPackage(
                    message.UserInfo, message.FeedName, message.PackageName,
                    PackageState.Partial, PackageState.DamagedDeleting,
                    tryWithPackageItemBefore: async pi =>
            {
                Trace.TraceInformation("Retrying package {0}", pi);
                return(await pi.Move(PackageState.Deleting, pi.Name));
            },
                    tryWithPackage: async(pi, p) =>
            {
                await deleteTask.DeletePackage(message.UserInfo, pi.Feed, pi.Name, pi, p);
            },
                    tryWithPackageItemAfter: async pi =>
            {
                await pi.Delete();
            }))
            // ReSharper restore RedundantArgumentName
            {
                return;
            }

            var indexTask = new IndexPackageTask(configuration, notifier, support, addInfoBuilder, pdbStoreManager, fileCompressor);

            // ReSharper disable RedundantArgumentName
            if (!await ProcessPackage(
                    message.UserInfo, message.FeedName, message.PackageName,
                    PackageState.Original, PackageState.DamagedIndexing,
                    tryWithPackageItemBefore: async pi =>
            {
                return(await pi.Copy(PackageState.Indexing, pi.Name));
            },
                    tryWithPackage: async(pi, p) =>
            {
                await indexTask.IndexPackage(message.UserInfo, pi.Feed, pi.Name, pi, p);
            },
                    tryWithPackageItemAfter: async pi =>
            {
                Trace.TraceInformation("Finished retrying package {0}", pi);
                await pi.Delete();
            }))
            // ReSharper restore RedundantArgumentName
            {
                return;
            }
        }