Created sort queue method to sort queue by attribute