 
                     newMessage.socialWork = socialWork
 
-                    let _ = try? realm.write {
-                        realm.add(newMessage)
-                    }
+                    realm.add(newMessage)
 
                     message = newMessage
                 }
 
                 if let message = message {
-                    let _ = try? realm.write {
-                        message.fromFriend = yepTeam
-                    }
+
+                    message.fromFriend = yepTeam
 
                     var conversation = yepTeam.conversation
 

                        newConversation.type = ConversationType.OneToOne.rawValue
                        newConversation.withFriend = yepTeam

                        let _ = try? realm.write {
                            realm.add(newConversation)
                        }

                        conversation = newConversation
                    }

                    if let conversation = conversation {
                        let _ = try? realm.write {

                            conversation.updatedUnixTime = message.createdUnixTime

                            message.conversation = conversation

                            var sectionDateMessageID: String?
                            tryCreateSectionDateMessageInConversation(conversation, beforeMessage: message, inRealm: realm) { sectionDateMessage in
                                realm.add(sectionDateMessage)
                                sectionDateMessageID = sectionDateMessage.messageID
                            }

                            // 通知更新 UI

                            var messageIDs = [String]()
                            if let sectionDateMessageID = sectionDateMessageID {
                                messageIDs.append(sectionDateMessageID)
                            }
                            messageIDs.append(message.messageID)

                            tryPostNewMessagesReceivedNotificationWithMessageIDs(messageIDs, messageAge: .New)
                        }

                    } else {
                        deleteMessage(message, inRealm: realm)
                    }
                }
            }

            let yepTeamUsername = "yep_team"

                                            return
                                        }

                                        var messageIDs = [String]()

                                        realm.beginWrite()

                                        if let yepTeam = yepTeamFromDiscoveredUser(discoveredUser, inRealm: realm) {
                                            messageIDs += messageIDsFromSyncSocialWorkPiece(SocialWorkPiece.Github(repo), yepTeam: yepTeam, inRealm: realm)
                                        }

                                        let _ = try? realm.commitWrite()

                                        // 通知更新 UI
                                        tryPostNewMessagesReceivedNotificationWithMessageIDs(messageIDs, messageAge: .New)
                                    }
                                })
                            }
                        }

                        let _ = try? realm.commitWrite()

                        // 通知更新 UI
                        tryPostNewMessagesReceivedNotificationWithMessageIDs(messageIDs, messageAge: .New)
                    }
                })
            }
