public static VersionedDocumentQueryResult<TTo> ConvertType<TFrom, TTo>(
            VersionedDocumentQueryResult<TFrom> recordResult,
            Func<TFrom, TTo> convertFunc)
        {
            var loaded = recordResult.Loaded.Select(x => ConvertType(x, convertFunc));
            var failed = recordResult.Failed.Select(x => ConvertType(x, convertFunc));

            return new VersionedDocumentQueryResult<TTo>(
                ImmutableList.CreateRange(loaded),
                ImmutableList.CreateRange(failed));
        }
        /// <summary>
        /// Creates a query result with converted documents.
        /// </summary>
        /// <typeparam name="TFrom">The type to convert from.</typeparam>
        /// <typeparam name="TTo">The type to convert to.</typeparam>
        /// <param name="result">The query result.</param>
        /// <param name="convertFunc">The function to convert to the target type.</param>
        /// <returns>The converted query result.</returns>
        public static VersionedDocumentQueryResult <TTo> WithType <TFrom, TTo>(
            this VersionedDocumentQueryResult <TFrom> result,
            Func <TFrom, TTo> convertFunc)
        {
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }
            if (convertFunc == null)
            {
                throw new ArgumentNullException(nameof(convertFunc));
            }

            return(VersionedResultUtils.ConvertType(result, convertFunc));
        }