docs: protected void deletePortletEntity(
              HttpServletRequest request, IPortletEntity portletEntity, boolean cacheOnly) {
          final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
  
          // Remove from request cache
          final PortletEntityCache<IPortletEntity> portletEntityMap =
                  this.getPortletEntityMap(request);
          portletEntityMap.removeEntity(portletEntityId);
  
          // Remove from session cache
          final PortletEntityCache<PortletEntityData> portletEntityDataMap =
                  this.getPortletEntityDataMap(request);
          portletEntityDataMap.removeEntity(portletEntityId);
  
          if (!cacheOnly && portletEntity instanceof PersistentPortletEntityWrapper) {
              final IPortletEntity persistentEntity =
                      ((PersistentPortletEntityWrapper) portletEntity).getPersistentEntity();
  
              try {
                  this.portletEntityDao.deletePortletEntity(persistentEntity);
              } catch (HibernateOptimisticLockingFailureException e) {
                  this.logger.warn(
                          "This persistent portlet has already been deleted: "
                                  + persistentEntity
                                  + ", trying to find and delete by layout node and user.");
                  final IPortletEntity existingPersistentEntity =
                          this.portletEntityDao.getPortletEntity(
                                  persistentEntity.getLayoutNodeId(), persistentEntity.getUserId());
                  if (existingPersistentEntity != null) {
                      this.portletEntityDao.deletePortletEntity(existingPersistentEntity);
                  }
              }
          }
      }