/**
  * Action to order the nodes of a site
  * @param \ride\web\cms\Cms $cms Facade to the CMS
  * @param string $site Id of the site
  * @param string $revision Name of the revision to work with
  * @param string $locale Code of the locale
  * @return null
  */
 public function orderAction(Cms $cms, $site, $revision, $locale)
 {
     if (!$cms->resolveNode($site, $revision)) {
         return;
     }
     $siteId = $site->getId();
     $order = array();
     $data = $this->request->getBodyParameter('data');
     parse_str($data, $data);
     foreach ($data['node'] as $nodeId => $parentId) {
         $order[$nodeId] = 0;
         $isRootNode = $parentId === null || $parentId === 'null';
         if ($isRootNode && $nodeId != $siteId) {
             throw new CmsException('Could not order the tree: nodes are not part of the provided site');
         } elseif (!$isRootNode) {
             $order[$parentId]++;
         }
     }
     unset($order[$siteId]);
     $cms->orderNodes($site, $order, $locale);
 }