EZP-22564: more responsibility for serializer