Dumps the given resource and all resources linked to it into a set of
        representation files in the given directory.

def to_files(self, resource, directory):
        """
        Dumps the given resource and all resources linked to it into a set of
        representation files in the given directory.
        """
        collections = self.__collect(resource)
        for (mb_cls, coll) in iteritems_(collections):
            fn = get_write_collection_path(mb_cls,
                                           self.__content_type,
                                           directory=directory)
            with open_text(os.path.join(directory, fn)) as strm:
                dump_resource(coll, strm, content_type=self.__content_type)