/**
   * Look up asset id by name
   *
   * @param ics context
   * @param c type
   * @param name name field value
   * @return asset id or null if not found.
   */
  public static AssetId lookupAssetId(ICS ics, String c, String name) {
    if (c == null || c.length() == 0) {
      throw new IllegalArgumentException("No such asset type: " + c);
    }

    if (!SqlHelper.tableExists(ics, c)) {
      throw new IllegalArgumentException("No such asset type: " + c);
    }

    if (name == null || name.length() == 0) {
      throw new IllegalArgumentException(
          "Cannot look up asset by name with an actual name.  Type: " + c);
    }
    ics.RegisterList("spu-gtfa", null);
    AssetList al = new AssetList();
    al.setField("name", name);
    al.setType(c);
    al.setExcludeVoided(false);
    al.setList("spu-gtfa");
    al.execute(ics);
    IList spugtfa = ics.GetList("spu-gtfa");
    ics.RegisterList("spu-gtfa", null);
    if (spugtfa != null && spugtfa.hasData()) {
      for (Row listRow : new IListIterable(spugtfa)) {
        return AssetIdUtils.createAssetId(c, listRow.getString("id"));
      }
    }
    return null;
  }
  public static boolean assetExistsByName(ICS ics, String c, String name) {
    if (c == null || c.length() == 0) {
      return false;
    }

    if (!SqlHelper.tableExists(ics, c)) {
      return false;
    }

    if (name == null || name.length() == 0) {
      return false;
    }
    ics.RegisterList("spu-gtfa", null);
    AssetList al = new AssetList();
    al.setField("name", name);
    al.setType(c);
    al.setExcludeVoided(false);
    al.setList("spu-gtfa");
    al.execute(ics);
    IList spugtfa = ics.GetList("spu-gtfa");
    ics.RegisterList("spu-gtfa", null);
    return spugtfa != null && spugtfa.hasData();
  }