fun <T : Any> T.applyPatch(patch: Any): T
Helper function for combining an object and a patch, such that patch fields override the fields in the object if they are present, otherwise the fields from the object come through. Note that the object and patch remain unchanged,and a new object is created and returned.