code: func (p Pages) GroupByParam(key string, order ...string) (PagesGroup, error) {
  	if len(p) < 1 {
  		return nil, nil
  	}
  
  	direction := "asc"
  
  	if len(order) > 0 && (strings.ToLower(order[0]) == "desc" || strings.ToLower(order[0]) == "rev" || strings.ToLower(order[0]) == "reverse") {
  		direction = "desc"
  	}
  
  	var tmp reflect.Value
  	var keyt reflect.Type
  	for _, e := range p {
  		param := resource.GetParamToLower(e, key)
  		if param != nil {
  			if _, ok := param.([]string); !ok {
  				keyt = reflect.TypeOf(param)
  				tmp = reflect.MakeMap(reflect.MapOf(keyt, pagesType))
  				break
  			}
  		}
  	}
  	if !tmp.IsValid() {
  		return nil, errors.New("there is no such a param")
  	}
  
  	for _, e := range p {
  		param := resource.GetParam(e, key)
  
  		if param == nil || reflect.TypeOf(param) != keyt {
  			continue
  		}
  		v := reflect.ValueOf(param)
  		if !tmp.MapIndex(v).IsValid() {
  			tmp.SetMapIndex(v, reflect.MakeSlice(pagesType, 0, 0))
  		}
  		tmp.SetMapIndex(v, reflect.Append(tmp.MapIndex(v), reflect.ValueOf(e)))
  	}
  
  	var r []PageGroup
  	for _, k := range sortKeys(tmp.MapKeys(), direction) {
  		r = append(r, PageGroup{Key: k.Interface(), Pages: tmp.MapIndex(k).Interface().(Pages)})
  	}
  
  	return r, nil
  }
docs: // GroupByParam groups by the given page parameter key's value and with the given order.
  // Valid values for order is asc, desc, rev and reverse.