private void sendDocuments(Cache cache) {
    long userId = SessionContext.getDefaultUserId();
    long groupId = LiferayServerContext.getGroupId();

    List<DocumentUploadCache> documentsToUpload =
        cache.get(
            DOCUMENT_UPLOAD,
            DocumentUploadCache.DIRTY
                + " = 1 "
                + "AND "
                + DocumentUploadCache.USER_ID
                + " = ? "
                + "AND "
                + DocumentUploadCache.GROUP_ID
                + " = ? ",
            userId,
            groupId);

    for (DocumentUploadCache document : documentsToUpload) {
      try {
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        DocumentField documentField = new DocumentField(objectObjectHashMap, new Locale("es"));
        documentField.createLocalFile(document.getPath());

        UploadService uploadService = new UploadService();
        JSONObject jsonObject =
            uploadService.uploadFile(
                documentField,
                document.getUserId(),
                document.getGroupId(),
                document.getRepositoryId(),
                document.getFolderId(),
                document.getFilePrefix());

        document.setDirty(false);
        document.setSyncDate(new Date());
        cache.set(document);
      } catch (Exception e) {
        LiferayLogger.e("Error sending documentsToUpload", e);
      }
    }
  }
  private void sendPortrait(Cache cache) {
    long userId = SessionContext.getDefaultUserId();

    List<TableCache> userPortraits =
        cache.get(
            USER_PORTRAIT_UPLOAD,
            " AND " + TableCache.DIRTY + " = 1 " + " AND " + TableCache.USER_ID + " = ? ",
            userId);

    for (TableCache userPortrait : userPortraits) {
      try {
        UserPortraitService userPortraitService = new UserPortraitService();
        JSONObject jsonObject =
            userPortraitService.uploadUserPortrait(
                Long.valueOf(userPortrait.getId()), userPortrait.getContent());

        userPortrait.setDirty(false);
        userPortrait.setSyncDate(new Date());
        cache.set(userPortrait);
      } catch (Exception e) {
        LiferayLogger.e("Error sending portrait images", e);
      }
    }
  }