private static void MarkExternalFields(ISchemaBuilder schemaBuilder, DocumentNode document)
        {
            Dictionary <NameString, ISet <NameString> > externalFieldLookup =
                new Dictionary <NameString, ISet <NameString> >();

            foreach (ObjectTypeDefinitionNodeBase objectType in
                     document.Definitions.OfType <ObjectTypeDefinitionNodeBase>())
            {
                if (!externalFieldLookup.TryGetValue(
                        objectType.Name.Value,
                        out ISet <NameString>?externalFields))
                {
                    externalFields = new HashSet <NameString>();
                    externalFieldLookup.Add(objectType.Name.Value, externalFields);
                }

                MarkExternalFields(objectType.Fields, externalFields);
            }

            schemaBuilder.AddExternalFieldLookup(externalFieldLookup);
        }