This logic can be moved into dedicated serializer, isn't it ?