class UserService {

	public User logout(String userId) {
		logger.debug("UserService.logout: Logging out account with userId: "
				+ userId);
		User account = user.findByUserid(userId);
		if (account != null) {
			account.setAuthtoken(null); // remove token
			account.setLogoutcount(account.getLogoutcount() + 1);
			user.save(account);
			logger.info("UserService.logout: Account logged out: "
					+ account.getUserid());
		} else {
			logger.warn("UserService.logout: Could not find account to logout with userId: "
					+ userId);
		}
		return account;
	}

}