New method for setting valid_fields
Inline method
Only typecast when necessary
Reduce duplication of checking for no casting required
Now will do autotype casting for more general classes
Special handling for casting arrays
Type conversions now done automatically for events, documents, people