Making the models serializable