deleteContainer :: (TS m, MonadError JobError m) => Job.ContainerId -> m UUID
deleteContainer name = do
    uuid <- maybe (throwError NoSuch) pure =<< ES.containerUUID name
    mapM_ (throwError . OutstandingDependants) . nonEmpty . fmap (^. Job.name) . filter isActive =<< ES.jobsUsingContainer name
    ES.deleteContainer name
    pure uuid
  where
    isActive = Job.isActiveStage . (^. Job.stage)
deleteContainer :: (TS m, MonadError JobError m) => Job.ContainerId -> m UUID
deleteContainer name = do
    uuid <- maybe (throwError NoSuch) pure =<< ES.containerUUID name
    mapM_ (throwError . OutstandingDependants) . nonEmpty . fmap (^. Job.name) . filter isActive =<< ES.jobsUsingContainer name
    ES.deleteContainer name
    pure uuid
  where
    isActive = Job.isActiveStage . (^. Job.stage)
deleteContainer name = do
    uuid <- maybe (throwError NoSuch) pure =<< ES.containerUUID name
    mapM_ (throwError . OutstandingDependants) . nonEmpty . fmap (^. Job.name) . filter isActive =<< ES.jobsUsingContainer name
    ES.deleteContainer name
    pure uuid
  where
    isActive = Job.isActiveStage . (^. Job.stage)