Skeleton of marshaller.

Add safe mode as I hope to re-use the same marshalling code for building
enities from statements as well as building entities from request data.