# File app/models/smerf_forms_user.rb, line 38
  def SmerfFormsUser.create_records(smerf_form_id, user_id, responses)
    transaction do
      # Create the record for the user
      smerf_forms_user = SmerfFormsUser.create(
            :user_id => user_id,
            :smerf_form_id => smerf_form_id,
            :responses => responses)
      # Create response records for all user responses
      responses.each do |question_response|
        # Check if response is a hash, if so process each response 
        # individually, i.e. each response to a question will have it's
        # own response record
        if (question_response[1].kind_of?(Hash) or 
          question_response[1].kind_of?(Array))
          question_response[1].each do |multichoice_response|
            smerf_forms_user.smerf_responses << SmerfResponse.new(
              :question_code => question_response[0],
              :response => multichoice_response[1]) if (!multichoice_response[1].blank?())           
          end
        else          
          smerf_forms_user.smerf_responses << SmerfResponse.new(
            :question_code => question_response[0],
            :response => question_response[1]) if (!question_response[1].blank?()) 
        end
      end
    end
  end