refactor out view model factory