docs: @Override
      @PortalTransactional
      public IPortalCookie addOrUpdatePortletCookie(IPortalCookie portalCookie, Cookie cookie) {
          final Set<IPortletCookie> portletCookies = portalCookie.getPortletCookies();
  
          boolean found = false;
          final String name = cookie.getName();
          final EntityManager entityManager = this.getEntityManager();
          for (final Iterator<IPortletCookie> portletCookieItr = portletCookies.iterator();
                  portletCookieItr.hasNext(); ) {
              final IPortletCookie portletCookie = portletCookieItr.next();
              if (name.equals(portletCookie.getName())) {
                  // Delete cookies with a maxAge of 0
                  if (cookie.getMaxAge() == 0) {
                      portletCookieItr.remove();
                      entityManager.remove(portletCookie);
                  } else {
                      portletCookie.updateFromCookie(cookie);
                  }
  
                  found = true;
                  break;
              }
          }
  
          if (!found) {
              IPortletCookie newPortletCookie = new PortletCookieImpl(portalCookie, cookie);
              portletCookies.add(newPortletCookie);
          }
  
          entityManager.persist(portalCookie);
  
          return portalCookie;
      }