Refactor common entity selection to directive