REFACTOR and FIX esclient in controller/service