UserId previousUserId = this.userId;
this.userId = newUserDetails.getUserId();
this.userDetails = newUserDetails;
this.groups.addAll(newUserGroups);
if(userId.isGuest()) {
EventBusManager.getManager().postEvent(new UserLoggedOutEvent(previousUserId));
}
else {
EventBusManager.getManager().postEvent(new UserLoggedInEvent(userId));
}
}