'Delete all the enrollment attributes for the given enrollment and
add new attributes.
Args:
enrollment(CourseEnrollment): \'CourseEnrollment\' for which attribute is to be added
data(list): list of dictionaries containing data to save'

@classmethod
def add_enrollment_attr(cls, enrollment, data_list):

    cls.objects.filter(enrollment=enrollment).delete()
    attributes = [cls(enrollment=enrollment, namespace=data['namespace'], name=data['name'], value=data['value']) for data in data_list]
    cls.objects.bulk_create(attributes)
