Doesn't serialize do this for you already?