refactorized code - json answer and sequelize promises