public function matchOrderBy($orderByValue, Array $mappings, Array $default = array()) {
    if (is_string($orderByValue)) {
      $orderByValue = array($orderByValue => 'ASC');
    }

    $orderBy = array();

    if (is_array($orderByValue)) {
      foreach ($orderByValue as $key => $sort) {
        $sort = mb_stripos($sort, 'desc') !== FALSE ? 'DESC' : 'ASC';

        if (array_key_exists($key, $mappings)) {
          $alias = $mappings[$key] ?: $key;
          $orderBy[$alias] = $sort;
        }
      }
    }

    if (empty($orderBy)) {
      return $default;
    }

    return $orderBy;
  }