Write message model and controller