Fix error in TJSONSerializer.WriteObject

CollectionItem with references to TSQLRecord objects where not properly
serialized.