move functions to services.js
new db functions