code: public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {
  
          try {
              JSONObject json = new JSONObject();
              JSONArray array = new JSONArray();
              for (CmsFavoriteEntry entry : favorites) {
                  array.put(entry.toJson());
              }
              json.put(BASE_KEY, array);
              String data = json.toString();
              CmsUser user = readUser();
              user.setAdditionalInfo(ADDINFO_KEY, data);
              m_cms.writeUser(user);
          } catch (JSONException e) {
              LOG.error(e.getLocalizedMessage(), e);
          }
  
      }
docs: Saves the favorites.
  
  @param favorites the list of favorites to save
  @throws CmsException if something goes wrong