/**
   * Add the application to the volume applicationIds attribute
   *
   * @param voluri The volumes that will be updated
   * @param dbClient
   */
  private void addApplicationToVolume(Volume volume, DbClient dbClient) {

    StringSet applications = volume.getVolumeGroupIds();
    if (applications == null) {
      applications = new StringSet();
    }
    applications.add(getId().toString());
    volume.setVolumeGroupIds(applications);
    dbClient.updateObject(volume);

    // Once volumes in VNX CG are added to an application, the CG's arrayConsistency
    // should turn to false
    if (volume.isInCG() && ControllerUtils.isVnxVolume(volume, dbClient)) {
      URI cguri = volume.getConsistencyGroup();
      BlockConsistencyGroup cg = dbClient.queryObject(BlockConsistencyGroup.class, cguri);
      if (cg.getArrayConsistency()) {
        log.info("Updated consistency group arrayConsistency");
        cg.setArrayConsistency(false);
        dbClient.updateObject(cg);
      }
    }
  }