code: private void saveElementList(CmsObject cms, List<CmsContainerElementBean> elementList, String listKey)
      throws CmsException {
  
          // limit the favorite list size to avoid the additional info size limit
          if (elementList.size() > DEFAULT_ELEMENT_LIST_SIZE) {
              elementList = elementList.subList(0, DEFAULT_ELEMENT_LIST_SIZE);
          }
  
          JSONArray data = new JSONArray();
  
          Set<String> excludedSettings = new HashSet<String>();
          // do not store the template contexts, since dragging an element into the page which might be invisible
          // doesn't make sense
          excludedSettings.add(CmsTemplateContextInfo.SETTING);
  
          for (CmsContainerElementBean element : elementList) {
              data.put(elementToJson(element, excludedSettings));
          }
          CmsUser user = cms.getRequestContext().getCurrentUser();
          user.setAdditionalInfo(listKey, data.toString());
          cms.writeUser(user);
      }
docs: Saves an element list to the user additional infos.<p>
  
  @param cms the cms context
  @param elementList the element list
  @param listKey the list key
  
  @throws CmsException if something goes wrong