docs: private Action handleRegisterRetrieved(final Long actionId, final String message) {
          final JpaAction action = getActionAndThrowExceptionIfNotFound(actionId);
          // do a manual query with CriteriaBuilder to avoid unnecessary field
          // queries and an extra
          // count query made by spring-data when using pageable requests, we
          // don't need an extra count
          // query, we just want to check if the last action status is a retrieved
          // or not.
          final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
          final CriteriaQuery<Object[]> queryActionStatus = cb.createQuery(Object[].class);
          final Root<JpaActionStatus> actionStatusRoot = queryActionStatus.from(JpaActionStatus.class);
          final CriteriaQuery<Object[]> query = queryActionStatus
                  .multiselect(actionStatusRoot.get(JpaActionStatus_.id), actionStatusRoot.get(JpaActionStatus_.status))
                  .where(cb.equal(actionStatusRoot.get(JpaActionStatus_.action).get(JpaAction_.id), actionId))
                  .orderBy(cb.desc(actionStatusRoot.get(JpaActionStatus_.id)));
          final List<Object[]> resultList = entityManager.createQuery(query).setFirstResult(0).setMaxResults(1)
                  .getResultList();
  
          // if the latest status is not in retrieve state then we add a retrieved
          // state again, we want
          // to document a deployment retrieved status and a cancel retrieved
          // status, but multiple
          // retrieves after the other we don't want to store to protect to
          // overflood action status in
          // case controller retrieves a action multiple times.
          if (resultList.isEmpty() || !Status.RETRIEVED.equals(resultList.get(0)[1])) {
              // document that the status has been retrieved
              actionStatusRepository
                      .save(new JpaActionStatus(action, Status.RETRIEVED, System.currentTimeMillis(), message));
  
              // don't change the action status itself in case the action is in
              // canceling state otherwise
              // we modify the action status and the controller won't get the
              // cancel job anymore.
              if (!action.isCancelingOrCanceled()) {
                  action.setStatus(Status.RETRIEVED);
                  return actionRepository.save(action);
              }
          }
          return action;
      }