public static void uploadPendingPhotos(final Context context) {
    Log.e(LOG, "############### uploadPendingPhotos, will start service");
    CacheUtil.getCachedData(
        context,
        CacheUtil.CACHE_PHOTOS,
        new CacheUtil.CacheUtilListener() {
          @Override
          public void onFileDataDeserialized(ResponseDTO response) {
            Log.e(LOG, "##### cached photo list returned - may start service if needed");
            if (response != null) {
              if (response.getPhotoCache() != null) {
                list = response.getPhotoCache().getPhotoUploadList();
                Intent intent = new Intent(context, PhotoUploadService.class);
                context.startService(intent);
                return;
              }

            } else {
              Log.w(LOG, "##### no photos found in cache for upload, response is NULL");
            }
          }

          @Override
          public void onDataCached() {}

          @Override
          public void onError() {}
        });
  }
  private static void addPhotoToCache(final Context context, final PhotoUploadDTO dto) {
    Log.w(LOG, "**** addPhotoToCache starting ...");
    CacheUtil.getCachedData(
        context,
        CacheUtil.CACHE_PHOTOS,
        new CacheUtil.CacheUtilListener() {
          @Override
          public void onFileDataDeserialized(ResponseDTO response) {
            if (response != null) {
              if (response.getPhotoCache() != null) {
                list = response.getPhotoCache().getPhotoUploadList();
                list.add(0, dto);
              }

            } else {
              response = new ResponseDTO();
              list = new ArrayList<>();
              list.add(dto);
            }
            Log.w(LOG, "**** setting cache...about to cache: " + list.size());
            response.setPhotoCache(new PhotoCache());
            response.getPhotoCache().setPhotoUploadList(list);
            CacheUtil.cacheData(
                context,
                response,
                CacheUtil.CACHE_PHOTOS,
                new CacheUtil.CacheUtilListener() {
                  @Override
                  public void onFileDataDeserialized(ResponseDTO response) {}

                  @Override
                  public void onDataCached() {
                    Log.e(LOG, "=======> photos have been cached: " + list.size());
                  }

                  @Override
                  public void onError() {}
                });
            // start service to upload images in cache
            Intent intent = new Intent(context, PhotoUploadService.class);
            context.startService(intent);
          }

          @Override
          public void onDataCached() {}

          @Override
          public void onError() {
            Log.e(LOG, "******* error in service");
          }
        });
  }