fixed updating the foreign keys when creating and editing messages -- need to find a solution for unset'ed attributes though