def METHOD_NAME(
    self, assignment: Assignment, groupings: List[Grouping]
) -> List[AssignmentGrouping]:
    """Store details of any groups and courses an assignment is in."""
    # Commit any changes to ensure that our user and role objects have ids
    self._db.flush()
    values = [
        {"assignment_id": assignment.id, "grouping_id": grouping.id}
        for grouping in groupings
    ]
    return list(
        bulk_upsert(
            self._db,
            model_class=AssignmentGrouping,
            values=values,
            index_elements=["assignment_id", "grouping_id"],
            update_columns=["updated"],
        )
    )