Refactor entity setting