private void download(
      long id, Download download, FinishedApk apk, ArrayList<DownloadModel> filesToDownload) {

    DownloadInfoRunnable info = getDownload(id);

    if (download.getCpiUrl() != null) {
      apk.setCpiUrl(download.getCpiUrl());
    }

    if (download.getReferrer() != null) {
      apk.setReferrer(download.getReferrer());
    } else {
      Log.d("AptoideDownloadService", "Creating download with no referrer");
    }

    info.setDownloadExecutor(new DownloadExecutor(apk));
    info.setDownload(download);
    info.setFilesToDownload(filesToDownload);

    boolean update;
    try {
      Aptoide.getContext().getPackageManager().getPackageInfo(download.getPackageName(), 0);
      update = true;
    } catch (PackageManager.NameNotFoundException e) {
      update = false;
    }

    info.setUpdate(update);
    downloads.put(info.getId(), info);
    NotificationCompat.Builder builder = setNotification(info.getId());
    info.setmBuilder(builder);
    info.download();

    if (mBuilder == null) mBuilder = createDefaultNotification();

    startForeground(-3, mBuilder.build());
    startService(new Intent(getApplicationContext(), DownloadService.class));

    startIfStopped();
    Toast.makeText(
            getApplicationContext(),
            getApplicationContext().getString(R.string.starting_download),
            Toast.LENGTH_LONG)
        .show();
  }