# File app/models/smerf_file.rb, line 145
  def validate
    # Decode the raw form data and validate all fields present as defined by the
    # setup_fields method which is called from the method below
    errors = validate_object_fields()
    # Process question groups
    @group_objects = nil
    if (!@groups.nil? and !@groups.empty?)
      # Process and validate question groups
      @group_objects = Array.new
      errors += validate_sub_objects(SmerfGroup, 
          @groups, @group_sort_order_field, @group_objects)
    end 
    # Check for errors and raise an exception 
    check_for_errors(errors)
    
    # Clear data no longer required, this will reduce the amount of data 
    # saved to the DB
    cleanup()
    remove_instance_variable(:@groups) 
    self.clear()
  end