Refactor users index action in api controller