added sorting feature for api/document service