moved mysqldb logic from view to model's save() method