move serialization to utils