def common_fields_attributes=(nested_attributes)
      nested_attributes.values.each do |attributes|
        common_field = common_fields.find {|field| field.id.to_s == attributes[:id] && attributes[:id].present? } || common_fields.build
        assign_to_or_mark_for_destruction(common_field, attributes, true, {})
      end
    end
def common_fields_attributes=(nested_attributes)
      nested_attributes.values.each do |attributes|
        common_field = common_fields.find {|field| field.id.to_s == attributes[:id] && attributes[:id].present? } || common_fields.build
        assign_to_or_mark_for_destruction(common_field, attributes, true, {})
      end
    end
Ensure all nested attributes for common fields get saved as common fields, and not as template fields