/**
  * {@inheritdoc}
  */
 public function addMessageToConversation(Conversation $conversation, array $details, $checkParticipants = true)
 {
     $details['message_parsed'] = $this->messageFormatter->parse($details['message'], [MessageFormatter::ME_USERNAME => $this->userRepository->find($details['author_id'])->name]);
     // TODO: Parser options...
     $message = $conversation->messages()->create($details);
     if ($message) {
         $conversation->update(['last_message_id' => $message->id]);
         if ($checkParticipants) {
             $users = $conversation->participants()->wherePivot('has_left', true)->get(['user_id'])->lists('user_id');
             $conversation->participants()->newPivotStatement()->where('conversation_id', $conversation->id)->whereIn('user_id', $users)->update(['has_left' => false]);
             // This would be the better query but only MySQL wants to run it, PgSQL and SQLite don't like it
             // $conversation->participants()->wherePivot('has_left', true)->update(['has_left' => false]);
         }
     }
     return $message;
 }