class MailboxUtils {

    public boolean hasChildren(MailboxId mailboxId, MailboxSession mailboxSession) throws MailboxException {
        return getMailboxFromId(mailboxId, mailboxSession)
                .map(Throwing.function(MessageManager::getMailboxPath).sneakyThrow())
                .map(Throwing.function(path -> mailboxManager.hasChildren(path, mailboxSession)))
                .orElse(false);
    }

    @Inject @VisibleForTesting public  MailboxUtils(MailboxManager mailboxManager);

}