@Override
	public void logoutUser() {
		
		UserDTO userDTO = getUserConnected(); 
		
		if (userDTO == null){
			throw new IllegalStateException("User is not connected.");
		}
		
		User user = null;
		
		try {
			if(usersManager.existUser(userDTO.getName())){
				user = usersManager.getUser(userDTO.getName());
			}else{
				throw new IllegalArgumentException("It was impossible to find the user.");
			}
		} catch (Exception e) {
//			logger.error("Error in logout: ", e);
			throw new IllegalStateException("Error in logout.");
		}
		
		if(!user.isConnect()){
			throw new IllegalStateException("User " + user.getUsername() + " not connected.");
		}

		connectOrDisconnect(user, false);
			
		removeAttributeSession();
	}