Move logging to model