 
 func unreadMessagesAfterMessageWithID(messageID: String?, failureHandler: ((Reason, String?) -> Void)?, completion: [JSONDictionary] -> Void) {
 
-    guard let realm = try? Realm() else { return }
-
-    let latestMessage = realm.objects(Message).sorted("createdUnixTime", ascending: false).first
-
-    let latestMessageID = latestMessage?.messageID
-
-    headUnreadMessagesAfterMessageWithID(latestMessageID, failureHandler: failureHandler, completion: { result in
-
-        guard let count = result["count"] as? Int, currentPage = result["current_page"] as? Int, perPage = result["per_page"] as? Int else {
-
-            println("unreadMessages not paging info.")
-
-            if let unreadMessagesData = result["messages"] as? [JSONDictionary] {
-                completion(unreadMessagesData)
-            } else {
-                completion([])
-            }
-
-            return
-        }
+    headUnreadMessagesAfterMessageWithID(messageID, failureHandler: failureHandler, completion: { result in
 
         guard let page1UnreadMessagesData = result["messages"] as? [JSONDictionary] else {
             completion([])
-
             return
         }
 
+        guard let count = result["count"] as? Int, currentPage = result["current_page"] as? Int, perPage = result["per_page"] as? Int else {
+
+            println("unreadMessagesAfterMessageWithID not paging info.")
+
+            completion(page1UnreadMessagesData)
+            return
+        }
+
         if count <= currentPage * perPage {
+            //println("page1UnreadMessagesData: \(page1UnreadMessagesData)")
             completion(page1UnreadMessagesData)
 
         } else {

            for page in 2..<((count / perPage) + ((count % perPage) > 0 ? 2 : 1)) {
                dispatch_group_enter(downloadGroup)

                moreUnreadMessagesAfterMessageWithID(latestMessageID, inPage: page, withPerPage: perPage, failureHandler: { (reason, errorMessage) in
                    failureHandler?(reason, errorMessage)

                    dispatch_group_leave(downloadGroup)

    }

    let parse: JSONDictionary -> JSONDictionary? = { data in
        return data
    }

