def filter(self, resource_manager, **params):
        """Query a set of resources."""
        m = self.resolve(resource_manager.resource_type)  # type: ChildTypeInfo

        parents = resource_manager.get_parent_manager()

        # Have to query separately for each parent's children.
        results = []
        for parent in parents.resources():
            try:
                subset = resource_manager.enumerate_resources(parent, m, **params)

                if subset:
                    # If required, append parent resource ID to all child resources
                    if m.annotate_parent:
                        for r in subset:
                            r[m.parent_key] = parent[parents.resource_type.id]

                    results.extend(subset)

            except Exception as e:
                log.warning('Child enumeration failed for {0}. {1}'
                            .format(parent[parents.resource_type.id], e))
                if m.raise_on_exception:
                    raise e

        return results