public RangerTag preDeleteTagByGuid(String guid) throws Exception {
    RangerTag exiting = tagStore.getTagByGuid(guid);

    if (exiting == null) {
      throw new Exception("Attempt to delete nonexistent tag, guid=" + guid);
    }

    List<RangerTagResourceMap> associations = tagStore.getTagResourceMapsForTagId(exiting.getId());
    if (CollectionUtils.isNotEmpty(associations)) {
      throw new Exception(
          "Attempt to delete tag which is associated with a service-resource, guid=" + guid);
    }
    return exiting;
  }
  public RangerTag preDeleteTag(Long id) throws Exception {
    if (id == null) {
      throw new Exception("Invalid/null id");
    }

    RangerTag existing = tagStore.getTag(id);

    if (existing == null) {
      throw new Exception("Attempt to delete nonexistent tag, id=" + id);
    }

    List<RangerTagResourceMap> associations = tagStore.getTagResourceMapsForTagId(existing.getId());
    if (CollectionUtils.isNotEmpty(associations)) {
      throw new Exception(
          "Attempt to delete tag which is associated with a service-resource, id=" + id);
    }
    return existing;
  }