Adding option to validate duplicate fields

As requested on #2869 , this is adding a new option, validate_duplicate_fields,
which, when on, should raise an error if there is a 2 fields with same name.