def METHOD_NAME(self, sam_template, sam_plugins):
    self._validate(sam_template)
    sam_plugins.act(LifeCycleEvents.before_transform_template, sam_template)
    macro_resolver = ResourceTypeResolver(sam_resources)
    document_errors = []
    for logical_id, resource in sam_template["Resources"].items():
        try:
            if macro_resolver.can_resolve(resource):
                macro_resolver.resolve_resource_type(resource).from_dict(
                    logical_id, resource, sam_plugins=sam_plugins
                )
        except (InvalidResourceException, InvalidEventException) as e:
            document_errors.append(e)
    if document_errors:
        raise InvalidDocumentException(document_errors)