Add sortArrayByIndex function to Utility service