ChatViewManager refactoring to move some code from frontend specific code to general code