public SearchDocument.UpdateLatest UpdateLatestFromCatalog(
            SearchFilters searchFilters,
            string[] versions,
            bool isLatestStable,
            bool isLatest,
            string normalizedVersion,
            string fullVersion,
            PackageDetailsCatalogLeaf leaf,
            string[] owners)
        {
            var document = new SearchDocument.UpdateLatest();

            // Determine if we have packageTypes to forward.
            // Otherwise, we need to let the system know that there were no explicit package types
            var packageTypes = leaf.PackageTypes != null && leaf.PackageTypes.Count > 0 ?
                               leaf.PackageTypes.Select(pt => pt.Name).ToArray() :
                               null;

            PopulateUpdateLatest(
                document,
                leaf.PackageId,
                searchFilters,
                lastUpdatedFromCatalog: true,
                lastCommitTimestamp: leaf.CommitTimestamp,
                lastCommitId: leaf.CommitId,
                versions: versions,
                isLatestStable: isLatestStable,
                isLatest: isLatest,
                fullVersion: fullVersion,
                owners: owners,
                packageTypes: packageTypes);
            _baseDocumentBuilder.PopulateMetadata(document, normalizedVersion, leaf);

            return(document);
        }
        private void PopulateUpdateLatest(
            SearchDocument.UpdateLatest document,
            string packageId,
            SearchFilters searchFilters,
            bool lastUpdatedFromCatalog,
            DateTimeOffset?lastCommitTimestamp,
            string lastCommitId,
            string[] versions,
            bool isLatestStable,
            bool isLatest,
            string fullVersion,
            string[] owners,
            string[] packageTypes)
        {
            PopulateVersions(
                document,
                packageId,
                searchFilters,
                lastUpdatedFromCatalog,
                lastCommitTimestamp,
                lastCommitId,
                versions,
                isLatestStable,
                isLatest);
            document.SearchFilters = DocumentUtilities.GetSearchFilterString(searchFilters);
            document.FullVersion   = fullVersion;

            // If the package has explicit types, we will set them here.
            // Otherwise, we will treat the package as a "Depedency" type and fill in the explicit type.
            if (packageTypes != null && packageTypes.Length > 0)
            {
                document.PackageTypes           = packageTypes;
                document.FilterablePackageTypes = packageTypes.Select(pt => pt.ToLowerInvariant()).ToArray();
            }
            else
            {
                document.PackageTypes           = ImpliedDependency;
                document.FilterablePackageTypes = FilterableImpliedDependency;
            }

            PopulateOwners(
                document,
                owners);
        }