def area_sorting_func(area):
        groups = tuple(area.groups.all())
        if not groups:
            return (0, 0, 0)
        return (1, groups[0].category.priority, groups[0].hierarchy, groups[0].priority)