/**
  * Add order by to query
  *
  * @param $order
  * @param $direction
  * @param $query
  * @return array
  */
 protected function orderBy($order, $direction, $query)
 {
     //If the order is NOT a array, convert to array yep !
     if (!is_array($order)) {
         $order = [$order];
     }
     //for each order by
     foreach ($order as $value) {
         //If we have custom order and the order by field is supported
         if (in_array($value, $this->model->getOrderBy())) {
             $query->orderBy($value, $direction);
         }
     }
     //Add the default order
     $order = $this->model->getDefaultOrder();
     $query->orderBy($order['orderBy'], $order['direction']);
     return $query;
 }