Refactoring viewBag to use functional object construction instead of pseudoclassical object construction