to me this looks like the wrong place to set the sort
why not add sorting in the hostgroup model instead?