this part should go into some service and return a promise