Moved logic from Databse.cs to UserRepository.cs