docs: protected void updateAuthorizationBasedOnCacheEntries(AuthorizationEntity authorization, String userId, String groupId,
                                                          Resource resource, String resourceId) {
      DbEntityManager dbManager = Context.getCommandContext().getDbEntityManager();
      List<AuthorizationEntity> list = dbManager.getCachedEntitiesByType(AuthorizationEntity.class);
      for (AuthorizationEntity authEntity : list) {
        boolean hasSameAuthRights = hasEntitySameAuthorizationRights(authEntity, userId, groupId, resource, resourceId);
        if (hasSameAuthRights) {
          int previousPermissions = authEntity.getPermissions();
          authorization.setPermissions(previousPermissions);
          dbManager.getDbEntityCache().remove(authEntity);
          return;
        }
      }
    }