implemented underscore sortBy function