def _save_forum_role(course_key, name):
 (role, created) = Role.objects.get_or_create(name=name, course_id=course_key)
 if (created is False):
  role.course_id = course_key
  role.save()
 return role

def _save_forum_role ( course_key , name ) : ( role , created ) = Role . objects . get_or_create ( name = name , course_id = course_key ) if ( created is False ) : role . course_id = course_key role . save ( ) return role
save and update course_key for all roles which are already created to keep course_id same as actual passed course key .