Implement serializer.