refactoring promises into separate service