/**
  * @inheritdoc
  */
 public function isFolderRootFolder(Folder $folder)
 {
     $path = $folder->getPath();
     return $folder->getNodeId() === null && empty($path) && $this->getFolderType($folder->getRootId()) === self::ROOT;
 }
 /**
  * Helper function for folder*Accessible checks.
  * @param \Conjoon\Mail\Client\Folder\Folder $folder
  * @param bool $considerChildFolders True to recurse into child folders
  *                                   and check whether these are accessible
  *                                   too
  *
  * @return bool true if folder(s) are accessible, otherwise false
  *
  * @throws FolderSecurityServiceException
  * @throws \Conjoon\Mail\Client\Folder\FolderDoesNotExistException
  */
 protected function isFolderAccessibleHelper(\Conjoon\Mail\Client\Folder\Folder $folder, $considerChildFolders = false)
 {
     $path = $folder->getPath();
     $nodeId = $folder->getNodeId();
     $rootId = $folder->getRootId();
     $checkNodeId = null;
     $checkForRoot = false;
     // the folder that gets transformed to its corresponding entity later on
     $transformToEntity = $folder;
     switch (true) {
         // only root id available, check only root
         case empty($path) && empty($nodeId):
             $checkNodeId = $rootId;
             $checkForRoot = true;
             break;
             // paths set, node id available.
         // paths set, node id available.
         case !empty($path) && !empty($nodeId):
             $doesMailFolderExist = $this->checkClientMailFolderExists($folder);
             // check if node id exists client side
             if ($doesMailFolderExist) {
                 // check if node is accessible
                 $checkNodeId = $nodeId;
             } else {
                 // check if root node is accessible
                 // if remote, check for rootID
                 try {
                     $repRemote = $this->folderCommons->isFolderRepresentingRemoteMailbox($folder);
                 } catch (\Conjoon\Mail\Client\Folder\FolderServiceException $e) {
                     throw new FolderSecurityServiceException("Exception trhown by previous exception: " . $e->getMessage(), 0, $e);
                 }
                 if (!$repRemote) {
                     throw new \Conjoon\Mail\Client\Folder\FolderDoesNotExistException("The folder {$folder} does not seem to exist");
                 }
                 $checkNodeId = $rootId;
                 $checkForRoot = true;
             }
             break;
         default:
             throw new FolderSecurityServiceException("Could not check whether folder \"" . $folder->__toString() . "\" is accessible ");
     }
     if ($checkForRoot) {
         // assemble new folder to check for availability of checkNodeId
         $folderCheck = new \Conjoon\Mail\Client\Folder\Folder(new \Conjoon\Mail\Client\Folder\DefaultFolderPath('["root", "' . $checkNodeId . '"]'));
         $doesMailFolderExist = $this->checkClientMailFolderExists($folderCheck);
         $transformToEntity = $folderCheck;
         if (!$doesMailFolderExist) {
             throw new \Conjoon\Mail\Client\Folder\FolderDoesNotExistException("The folder {$folder} does not seem to exist");
         }
     }
     return $this->checkFolderHierarchyAccessible($this->folderCommons->getFolderEntity($transformToEntity), $considerChildFolders === true);
 }