def duplicate(page, parent = nil)
      new_element = self.class.new(self.attributes)
      case parent.class.to_s
      when ChoiceField
        new_element.conditional_id = parent.id
      when QuestionGrid, QuestionGridWithTotal
        new_element.question_grid_id = parent.id
      end
      new_element.save(:validate => false)
      PageElement.create(:element => new_element, :page => page) unless parent
      
      # duplicate children
      if respond_to?(:elements) && elements.present?
        elements.each {|e| e.duplicate(page, new_element)}
      end
      
      new_element
    end
def duplicate(page, parent = nil)
      new_element = self.class.new(self.attributes)
      case parent.class.to_s
      when ChoiceField
        new_element.conditional_id = parent.id
      when QuestionGrid, QuestionGridWithTotal
        new_element.question_grid_id = parent.id
      end
      new_element.save(:validate => false)
      PageElement.create(:element => new_element, :page => page) unless parent
      
      # duplicate children
      if respond_to?(:elements) && elements.present?
        elements.each {|e| e.duplicate(page, new_element)}
      end
      
      new_element
    end
copy an item and all it's children