Service sorting for dependencies