The solution to this is actually a bit backwards to what was posted. You need to create a message and assign two user models to it instead of the other way round. Here's an example:
// Make some models
list($sender, $recipient) = R::dispense('user', 2);
$message = R::dispense('message');
// Set some data
$sender->name = 'Sender';
$recipient->name = 'Recipient';
$message->title = "Hello world";
// Associate users and message
$message->sender = $sender;
$message->recipient = $recipient;
// Store everything
R::store($message);
Really easy. RedBean takes care of storing the updated user info when R::store($message)
is called. The messages table then looks like this:
+----+-------------+-----------+--------------+
| id | title | sender_id | recipient_id |
+----+-------------+-----------+--------------+
| 6 | Hello world | 3 | 4 |
+----+-------------+-----------+--------------+