refactorised not DRY code in retriever service