Making serialization process more generic.