/// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual void WalkNavigations(Expression querySourceReferenceExpression, IEntityType entityType, Stack <INavigation> stack)
        {
            var outboundNavigations
                = entityType.GetNavigations()
                  .Concat(entityType.GetDerivedTypes().SelectMany(et => et.GetDeclaredNavigations()))
                  .Where(ShouldInclude)
                  .ToList();

            if (outboundNavigations.Count == 0 &&
                stack.Count > 0)
            {
                _queryCompilationContext.AddAnnotations(
                    new[]
                {
                    new IncludeResultOperator(
                        stack.Reverse().ToArray(),
                        querySourceReferenceExpression,
                        implicitLoad: true)
                });
            }
            else
            {
                foreach (var navigation in outboundNavigations)
                {
                    stack.Push(navigation);

                    WalkNavigations(querySourceReferenceExpression, navigation.GetTargetType(), stack);

                    stack.Pop();
                }
            }
        }