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: 20160823094126_add_unique_index_to_multiple_response_answer_options.rb
    path of file: ./repos/coursemology2/db/migrate
    
    the code of the file until where you have to start completion: class AddUniqueIndexToMultipleResponseAnswerOptions < ActiveRecord::Migration[4.2]
  def change
    remove_duplicates
    add_index :course_assessment_answer_
    
  def remove_duplicates
    grouped = Course::Assessment::Answer::MultipleResponseOption.
              all.group_by { |mro| [mro.answer_id, mro.option_id] }
    grouped.values.each do |duplicates|
      duplicates.pop # Keep last one
      duplicates.each(&:destroy)
    end
  end