Moved type conversion to a separate function for persistence methods update_model and create_model