it might make sense to explore duck typing for this:
https://github.com/symfony/Serializer/blob/master/Tests/SerializerTest.php#L123