Fixed serialiser to deal with data objects and Documents