extracting persistence logic into UserRepository class