'Returns a limited and offset list of both types of contents, filtered
and in some order.'

def _union_of_contents(self, container, expand_models=True, **kwargs):

    contents_results = self._union_of_contents_query(container, **kwargs).all()
    if (not expand_models):
        return contents_results
    id_map = dict(((self.contained_class_type_name, []), (self.subcontainer_class_type_name, [])))
    for result in contents_results:
        result_type = self._get_union_type(result)
        contents_id = self._get_union_id(result)
        if (result_type in id_map):
            id_map[result_type].append(contents_id)
        else:
            raise TypeError('Unknown    contents    type:', result_type)
    contained_ids = id_map[self.contained_class_type_name]
    id_map[self.contained_class_type_name] = self._contained_id_map(contained_ids)
    subcontainer_ids = id_map[self.subcontainer_class_type_name]
    id_map[self.subcontainer_class_type_name] = self._subcontainer_id_map(subcontainer_ids)
    contents = []
    for result in contents_results:
        result_type = self._get_union_type(result)
        contents_id = self._get_union_id(result)
        content = id_map[result_type][contents_id]
        contents.append(content)
    return contents
