You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: group.rb
    path of file: ./repos/coursemology2/app/models/course
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class 
    
  def validate_new_users_are_unique
    new_group_users = group_users.select(&:new_record?)
    return if new_group_users.count == new_group_users.uniq(&:course_user).count

    errors.add(:group_users, :invalid)
    (new_group_users - new_group_users.uniq(&:course_user)).each do |group_user|
      group_user.errors.add(:course_user, :taken)
    end
  end