Refactor the converstion into classes and add presave hook