'Wrapper for objects.update_or_create.'

@classmethod
def update_or_create_grade(cls, **params):

    cls._prepare_params_and_visible_blocks(params)
    first_attempted = params.pop('first_attempted')
    user_id = params.pop('user_id')
    usage_key = params.pop('usage_key')
    (grade, _) = cls.objects.update_or_create(user_id=user_id, course_id=usage_key.course_key, usage_key=usage_key, defaults=params)
    if ((first_attempted is not None) and (grade.first_attempted is None)):
        if waffle.waffle().is_enabled(waffle.ESTIMATE_FIRST_ATTEMPTED):
            grade.first_attempted = first_attempted
        else:
            grade.first_attempted = now()
        grade.save()
    cls._emit_grade_calculated_event(grade)
    return grade
