/**
  * @return Response
  */
 public function actionOrdering()
 {
     $data = Yii::$app->request->getBodyParam('data', []);
     foreach ($data as $id => $order) {
         if ($target = MenuItem::findOne($id)) {
             $target->updateAttributes(['ordering' => intval($order)]);
         }
     }
     MenuItem::find()->roots()->one()->reorderNode('ordering');
     DbState::updateState(MenuItem::tableName());
     return $this->redirect(ArrayHelper::getValue(Yii::$app->request, 'referrer', ['index']));
 }