code: private List<CmsContainerElementBean> updateFavoriteRecentList(
          CmsResource containerPage,
          String clientId,
          List<CmsContainerElementBean> list)
      throws CmsException {
  
          try {
              CmsContainerElementBean element = getCachedElement(clientId, containerPage.getRootPath());
              Map<String, String> settings = new HashMap<String, String>(element.getIndividualSettings());
              String formatterID = null;
              Iterator<Entry<String, String>> entries = settings.entrySet().iterator();
              while (entries.hasNext()) {
                  Entry<String, String> entry = entries.next();
                  if (entry.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)) {
                      formatterID = entry.getValue();
                      entries.remove();
                  }
              }
              settings.put(CmsFormatterConfig.FORMATTER_SETTINGS_KEY, formatterID);
              settings.put(SOURCE_CONTAINERPAGE_ID_SETTING, containerPage.getStructureId().toString());
              element = CmsContainerElementBean.cloneWithSettings(element, settings);
              Iterator<CmsContainerElementBean> listIt = list.iterator();
              while (listIt.hasNext()) {
                  CmsContainerElementBean listElem = listIt.next();
                  if (element.getInstanceId().equals(listElem.getInstanceId())) {
                      listIt.remove();
                  }
              }
              list.add(0, element);
              return list;
          } catch (CmsVfsResourceNotFoundException e) {
              LOG.warn(e.getLocalizedMessage(), e);
              return list;
          }
      }
docs: Update favorite or recent list with the given element.<p>
  
  @param containerPage the edited container page
  @param clientId the elements client id
  @param list the list to update
  
  @return the updated list
  
  @throws CmsException in case reading the element resource fails