fix use of SQL model in UnattachedMessage