'Collect external resources set on resource_attr attribute of all models.'

def _collect_external_resources(self, resource_attr):

    external_resources = []
    for (_, cls) in sorted(Model.model_class_reverse_map.items(), key=(lambda arg: arg[0])):
        external = getattr(cls, resource_attr, None)
        if isinstance(external, string_types):
            if (external not in external_resources):
                external_resources.append(external)
        elif isinstance(external, list):
            for e in external:
                if (e not in external_resources):
                    external_resources.append(e)
    return external_resources
