@Override
  public TrashEntry getTrashEntry() throws PortalException {
    if (!isInTrash()) {
      return null;
    }

    TrashEntry trashEntry =
        TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(), getTrashEntryClassPK());

    if (trashEntry != null) {
      return trashEntry;
    }

    TrashHandler trashHandler = getTrashHandler();

    if (!Validator.isNull(trashHandler.getContainerModelClassName(getPrimaryKey()))) {
      ContainerModel containerModel = null;

      try {
        containerModel = trashHandler.getParentContainerModel(this);
      } catch (NoSuchModelException nsme) {
        return null;
      }

      while (containerModel != null) {
        if (containerModel instanceof TrashedModel) {
          TrashedModel trashedModel = (TrashedModel) containerModel;

          return trashedModel.getTrashEntry();
        }

        trashHandler =
            TrashHandlerRegistryUtil.getTrashHandler(
                trashHandler.getContainerModelClassName(containerModel.getContainerModelId()));

        if (trashHandler == null) {
          return null;
        }

        containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
      }
    }

    return null;
  }
  @Override
  public boolean isInTrashContainer() {
    TrashHandler trashHandler = getTrashHandler();

    if ((trashHandler == null) || Validator.isNull(trashHandler.getContainerModelClassName())) {
      return false;
    }

    try {
      ContainerModel containerModel = trashHandler.getParentContainerModel(this);

      if (containerModel == null) {
        return false;
      }

      if (containerModel instanceof TrashedModel) {
        return ((TrashedModel) containerModel).isInTrash();
      }
    } catch (Exception e) {
    }

    return false;
  }