Move schema serialization to logic layer.