private async Task DownloadNuspecAsync(ConcurrentBag <PackageIdentity> work)
        {
            while (work.TryTake(out var packageIdentity))
            {
                var success = await _downloader.StoreNuspecAsync(
                    packageIdentity.Id,
                    packageIdentity.Version,
                    CancellationToken.None);

                if (!success)
                {
                    _logger.LogWarning("The .nuspec for package {Id} {Version} could not be found.", packageIdentity.Id, packageIdentity.Version);
                }
            }
        }
        public async Task <bool> IsMatchAsync(PackageQueryContext context, PackageConsistencyState state)
        {
            if (context.Package.Deleted)
            {
                return(false);
            }

            if (!context.Nuspec.Exists ||
                context.Nuspec.Document == null)
            {
                await _nuspecDownloader.StoreNuspecAsync(
                    context.Package.Id,
                    context.Package.Version,
                    CancellationToken.None);

                throw new InvalidOperationException($"The .nuspec for {context.Package.Id} {context.Package.Version} could not be loaded.");
            }

            return(false);
        }