function logic from index.js was moved to user-repository.js