refactor put app config into app.js
add unique validation to the model