Encapsulate more logic in ecorest package