Filter unique values and sort collections properly