// ferret out the layout manager
HttpServletRequest servletRequest = this.portalRequestUtils.getCurrentPortalRequest();
IUserInstance userInstance = this.userInstanceManager.getUserInstance(servletRequest);
IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
IUserLayoutManager layoutManager = preferencesManager.getUserLayoutManager();
IUserLayoutNodeDescription nodeDescription = layoutManager.getNode(nodeId);
String userFacingNodeName = nodeDescription.getName();
response.setRenderParameter("nameOfFavoriteActedUpon", userFacingNodeName);
if (nodeDescription.isDeleteAllowed()) {
boolean nodeSuccessfullyDeleted = layoutManager.deleteNode(nodeId);
if (nodeSuccessfullyDeleted) {
layoutManager.saveUserLayout();
response.setRenderParameter("successMessageCode", "favorites.unfavorite.success.parameterized");
IUserLayout updatedLayout = layoutManager.getUserLayout();
// if removed last favorite, return to VIEW mode
if (! FavoritesUtils.hasAnyFavorites(updatedLayout)) {
response.setPortletMode(PortletMode.VIEW);
}