docs: function(chatMessage) {
                  var threadId = chatMessage.subjectId,
                      type = chatMessage.type,
                      messageContent = (typeof chatMessage.content === 'string')
                          ? JSON.parse(chatMessage.content)
                          : {},
                      contentCount = chatMessage.contentCount,
                      uniqueId = chatMessage.uniqueId;
  
                  switch (type) {
                      /**
                       * Type 1    Get Threads
                       */
                      case chatMessageVOTypes.CREATE_THREAD:
                          messageContent.uniqueId = uniqueId;
                          createThread(messageContent, true);
  
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
  
                          break;
  
                      /**
                       * Type 2    Message
                       */
                      case chatMessageVOTypes.MESSAGE:
                          newMessageHandler(threadId, messageContent);
                          break;
  
                      /**
                       * Type 3    Message Sent
                       */
                      case chatMessageVOTypes.SENT:
                          if (sendMessageCallbacks[uniqueId] && sendMessageCallbacks[uniqueId].onSent) {
                              sendMessageCallbacks[uniqueId].onSent({
                                  uniqueId: uniqueId
                              });
                              delete(sendMessageCallbacks[uniqueId].onSent);
                              threadCallbacks[threadId][uniqueId].onSent = true;
                          }
                          break;
  
                      /**
                       * Type 4    Message Delivery
                       */
                      case chatMessageVOTypes.DELIVERY:
                          if (fullResponseObject) {
                              getHistory({
                                  offset: 0,
                                  threadId: threadId,
                                  id: messageContent.messageId
                              }, function(result) {
                                  if (!result.hasError && !result.cache) {
                                      fireEvent('messageEvents', {
                                          type: 'MESSAGE_DELIVERY',
                                          result: {
                                              message: result.result.history[0],
                                              threadId: threadId,
                                              senderId: messageContent.participantId
                                          }
                                      });
                                  }
                              });
                          }
                          else {
                              fireEvent('messageEvents', {
                                  type: 'MESSAGE_DELIVERY',
                                  result: {
                                      message: messageContent.messageId,
                                      threadId: threadId,
                                      senderId: messageContent.participantId
                                  }
                              });
                          }
  
                          sendMessageCallbacksHandler(chatMessageVOTypes.DELIVERY, threadId, uniqueId);
                          break;
  
                      /**
                       * Type 5    Message Seen
                       */
                      case chatMessageVOTypes.SEEN:
                          if (fullResponseObject) {
                              getHistory({
                                  offset: 0,
                                  threadId: threadId,
                                  id: messageContent.messageId
                              }, function(result) {
                                  if (!result.hasError && !result.cache) {
                                      fireEvent('messageEvents', {
                                          type: 'MESSAGE_SEEN',
                                          result: {
                                              message: result.result.history[0],
                                              threadId: threadId,
                                              senderId: messageContent.participantId
                                          }
                                      });
                                  }
                              });
                          }
                          else {
                              fireEvent('messageEvents', {
                                  type: 'MESSAGE_SEEN',
                                  result: {
                                      message: messageContent.messageId,
                                      threadId: threadId,
                                      senderId: messageContent.participantId
                                  }
                              });
                          }
  
                          sendMessageCallbacksHandler(chatMessageVOTypes.SEEN, threadId, uniqueId);
                          break;
  
                      /**
                       * Type 6    Chat Ping
                       */
                      case chatMessageVOTypes.PING:
                          break;
  
                      /**
                       * Type 7    Block Contact
                       */
                      case chatMessageVOTypes.BLOCK:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
                          break;
  
                      /**
                       * Type 8    Unblock Blocked User
                       */
                      case chatMessageVOTypes.UNBLOCK:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
                          break;
  
                      /**
                       * Type 9   Leave Thread
                       */
                      case chatMessageVOTypes.LEAVE_THREAD:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
  
                          /**
                           * Remove the participant from cache
                           */
                          if (canUseCache) {
                              if (db) {
                                  /**
                                   * Remove the participant from participants
                                   * table
                                   */
                                  db.participants.where('threadId')
                                      .equals(threadId)
                                      .and(function(participant) {
                                          return (participant.id == messageContent.id || participant.owner == userInfo.id);
                                      })
                                      .delete()
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      });
  
                                  /**
                                   * If this is the user who is leaving the thread
                                   * we should delete the thread and messages of
                                   * thread from this users cache database
                                   */
                                  if (messageContent.id == userInfo.id) {
  
                                      /**
                                       * Remove Thread from this users cache
                                       */
                                      db.threads.where('[owner+id]')
                                          .equals([userInfo.id, threadId])
                                          .delete()
                                          .catch(function(error) {
                                              fireEvent('error', {
                                                  code: error.code,
                                                  message: error.message,
                                                  error: error
                                              });
                                          });
  
                                      /**
                                       * Remove all messages of the thread which
                                       * this user left
                                       */
                                      db.messages.where('threadId')
                                          .equals(threadId)
                                          .and(function(message) {
                                              return message.owner == userInfo.id;
                                          })
                                          .delete()
                                          .catch(function(error) {
                                              fireEvent('error', {
                                                  code: error.code,
                                                  message: error.message,
                                                  error: error
                                              });
                                          });
                                  }
                              }
                              else {
                                  fireEvent('error', {
                                      code: 6601,
                                      message: CHAT_ERRORS[6601],
                                      error: null
                                  });
                              }
                          }
  
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [threadId]
                              }, function(threadsResult) {
                                  if (!threadsResult.cache) {
                                      var threads = threadsResult.result.threads;
                                      if (threads.length > 0) {
                                          fireEvent('threadEvents', {
                                              type: 'THREAD_LEAVE_PARTICIPANT',
                                              result: {
                                                  thread: threads[0],
                                                  participant: formatDataToMakeParticipant(messageContent, threadId)
                                              }
                                          });
  
                                          fireEvent('threadEvents', {
                                              type: 'THREAD_LAST_ACTIVITY_TIME',
                                              result: {
                                                  thread: threads[0]
                                              }
                                          });
                                      }
                                      else {
                                          fireEvent('threadEvents', {
                                              type: 'THREAD_LEAVE_PARTICIPANT',
                                              result: {
                                                  threadId: threadId,
                                                  participant: formatDataToMakeParticipant(messageContent, threadId)
                                              }
                                          });
                                      }
                                  }
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_LEAVE_PARTICIPANT',
                                  result: {
                                      thread: threadId,
                                      participant: formatDataToMakeParticipant(messageContent, threadId)
                                  }
                              });
  
                              fireEvent('threadEvents', {
                                  type: 'THREAD_LAST_ACTIVITY_TIME',
                                  result: {
                                      thread: threadId
                                  }
                              });
                          }
                          break;
  
                      /**
                       * Type 11    Add Participant to Thread
                       */
                      case chatMessageVOTypes.ADD_PARTICIPANT:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
  
                          /**
                           * Add participants into cache
                           */
                          if (canUseCache) {
                              if (db) {
                                  var cacheData = [];
  
                                  for (var i = 0; i < messageContent.participants.length; i++) {
                                      try {
                                          var tempData = {},
                                              salt = Utility.generateUUID();
  
                                          tempData.id = messageContent.participants[i].id;
                                          tempData.owner = userInfo.id;
                                          tempData.threadId = messageContent.id;
                                          tempData.notSeenDuration = messageContent.participants[i].notSeenDuration;
                                          tempData.name = Utility.crypt(messageContent.participants[i].name, cacheSecret, salt);
                                          tempData.contactName = Utility.crypt(messageContent.participants[i].contactName, cacheSecret, salt);
                                          tempData.email = Utility.crypt(messageContent.participants[i].email, cacheSecret, salt);
                                          tempData.expireTime = new Date().getTime() + cacheExpireTime;
                                          tempData.data = Utility.crypt(JSON.stringify(unsetNotSeenDuration(messageContent.participants[i])), cacheSecret, salt);
                                          tempData.salt = salt;
  
                                          cacheData.push(tempData);
                                      }
                                      catch (error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      }
                                  }
  
                                  db.participants.bulkPut(cacheData)
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      });
                              }
                              else {
                                  fireEvent('error', {
                                      code: 6601,
                                      message: CHAT_ERRORS[6601],
                                      error: null
                                  });
                              }
                          }
  
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [messageContent.id]
                              }, function(threadsResult) {
                                  var threads = threadsResult.result.threads;
  
                                  if (!threadsResult.cache) {
                                      fireEvent('threadEvents', {
                                          type: 'THREAD_ADD_PARTICIPANTS',
                                          result: {
                                              thread: threads[0]
                                          }
                                      });
  
                                      fireEvent('threadEvents', {
                                          type: 'THREAD_LAST_ACTIVITY_TIME',
                                          result: {
                                              thread: threads[0]
                                          }
                                      });
                                  }
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_ADD_PARTICIPANTS',
                                  result: {
                                      thread: threadId
                                  }
                              });
  
                              fireEvent('threadEvents', {
                                  type: 'THREAD_LAST_ACTIVITY_TIME',
                                  result: {
                                      thread: threadId
                                  }
                              });
                          }
                          break;
  
                      /**
                       * Type 13    Get Contacts List
                       */
                      case chatMessageVOTypes.GET_CONTACTS:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 14    Get Threads List
                       */
                      case chatMessageVOTypes.GET_THREADS:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 15    Get Message History of an Thread
                       */
                      case chatMessageVOTypes.GET_HISTORY:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 17    Remove sb from thread
                       */
                      case chatMessageVOTypes.REMOVED_FROM_THREAD:
  
                          fireEvent('threadEvents', {
                              type: 'THREAD_REMOVED_FROM',
                              result: {
                                  thread: threadId
                              }
                          });
  
                          /**
                           * This user has been removed from a thread
                           * So we should delete thread, its participants
                           * and it's messages from this users cache
                           */
                          if (canUseCache) {
                              if (db) {
                                  /**
                                   * Remove Thread from this users cache
                                   */
                                  db.threads.where('[owner+id]')
                                      .equals([userInfo.id, threadId])
                                      .delete()
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      });
  
                                  /**
                                   * Remove all messages of the thread which this
                                   * user left
                                   */
                                  db.messages.where('threadId')
                                      .equals(threadId)
                                      .and(function(message) {
                                          return message.owner == userInfo.id;
                                      })
                                      .delete()
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      });
  
                                  /**
                                   * Remove all participants of the thread which
                                   * this user left
                                   */
                                  db.participants.where('threadId')
                                      .equals(threadId)
                                      .and(function(participant) {
                                          return participant.owner == userInfo.id;
                                      })
                                      .delete()
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      });
  
                              }
                              else {
                                  fireEvent('error', {
                                      code: 6601,
                                      message: CHAT_ERRORS[6601],
                                      error: null
                                  });
                              }
                          }
  
                          break;
  
                      /**
                       * Type 18    Remove a /participant from Thread
                       */
                      case chatMessageVOTypes.REMOVE_PARTICIPANT:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
  
                          /**
                           * Remove the participant from cache
                           */
                          if (canUseCache) {
                              if (db) {
                                  for (var i = 0; i <
                                  messageContent.length; i++) {
                                      db.participants.where('id')
                                          .equals(messageContent[i].id)
                                          .and(function(participants) {
                                              return participants.threadId == threadId;
                                          })
                                          .delete()
                                          .catch(function(error) {
                                              fireEvent('error', {
                                                  code: error.code,
                                                  message: error.message,
                                                  error: error
                                              });
                                          });
                                  }
                              }
                              else {
                                  fireEvent('error', {
                                      code: 6601,
                                      message: CHAT_ERRORS[6601],
                                      error: null
                                  });
                              }
                          }
  
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [threadId]
                              }, function(threadsResult) {
                                  var threads = threadsResult.result.threads;
  
                                  if (!threadsResult.cache) {
                                      fireEvent('threadEvents', {
                                          type: 'THREAD_REMOVE_PARTICIPANTS',
                                          result: {
                                              thread: threads[0]
                                          }
                                      });
  
                                      fireEvent('threadEvents', {
                                          type: 'THREAD_LAST_ACTIVITY_TIME',
                                          result: {
                                              thread: threads[0]
                                          }
                                      });
                                  }
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_REMOVE_PARTICIPANTS',
                                  result: {
                                      thread: threadId
                                  }
                              });
  
                              fireEvent('threadEvents', {
                                  type: 'THREAD_LAST_ACTIVITY_TIME',
                                  result: {
                                      thread: threadId
                                  }
                              });
                          }
                          break;
  
                      /**
                       * Type 19    Mute Thread
                       */
                      case chatMessageVOTypes.MUTE_THREAD:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
  
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [threadId]
                              }, function(threadsResult) {
                                  var threads = threadsResult.result.threads;
  
                                  fireEvent('threadEvents', {
                                      type: 'THREAD_MUTE',
                                      result: {
                                          thread: threads[0]
                                      }
                                  });
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_MUTE',
                                  result: {
                                      thread: threadId
                                  }
                              });
                          }
  
                          break;
  
                      /**
                       * Type 20    Unmute muted Thread
                       */
                      case chatMessageVOTypes.UNMUTE_THREAD:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
  
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [threadId]
                              }, function(threadsResult) {
                                  var threads = threadsResult.result.threads;
  
                                  fireEvent('threadEvents', {
                                      type: 'THREAD_UNMUTE',
                                      result: {
                                          thread: threads[0]
                                      }
                                  });
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_UNMUTE',
                                  result: {
                                      thread: threadId
                                  }
                              });
                          }
                          break;
  
                      /**
                       * Type 21    Update Thread Info
                       */
                      case chatMessageVOTypes.UPDATE_THREAD_INFO:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
  
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [messageContent.id]
                              }, function(threadsResult) {
                                  var thread = formatDataToMakeConversation(threadsResult.result.threads[0]);
  
                                  /**
                                   * Add Updated Thread into cache database #cache
                                   */
                                  if (canUseCache) {
                                      if (db) {
                                          var tempData = {};
  
                                          try {
                                              var salt = Utility.generateUUID();
  
                                              tempData.id = thread.id;
                                              tempData.owner = userInfo.id;
                                              tempData.title = Utility.crypt(thread.title, cacheSecret, salt);
                                              tempData.time = thread.time;
                                              tempData.data = Utility.crypt(JSON.stringify(unsetNotSeenDuration(thread)), cacheSecret, salt);
                                              tempData.salt = salt;
                                          }
                                          catch (error) {
                                              fireEvent('error', {
                                                  code: error.code,
                                                  message: error.message,
                                                  error: error
                                              });
                                          }
  
                                          db.threads.put(tempData)
                                              .catch(function(error) {
                                                  fireEvent('error', {
                                                      code: error.code,
                                                      message: error.message,
                                                      error: error
                                                  });
                                              });
                                      }
                                      else {
                                          fireEvent('error', {
                                              code: 6601,
                                              message: CHAT_ERRORS[6601],
                                              error: null
                                          });
                                      }
                                  }
  
                                  fireEvent('threadEvents', {
                                      type: 'THREAD_INFO_UPDATED',
                                      result: {
                                          thread: thread
                                      }
                                  });
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_INFO_UPDATED',
                                  result: {
                                      thread: messageContent.id
                                  }
                              });
                          }
                          break;
  
                      /**
                       * Type 22    Forward Multiple Messages
                       */
                      case chatMessageVOTypes.FORWARD_MESSAGE:
                          newMessageHandler(threadId, messageContent);
                          break;
  
                      /**
                       * Type 23    User Info
                       */
                      case chatMessageVOTypes.USER_INFO:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
                          break;
  
                      /**
                       * Type 25    Get Blocked List
                       */
                      case chatMessageVOTypes.GET_BLOCKED:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 27    Thread Participants List
                       */
                      case chatMessageVOTypes.THREAD_PARTICIPANTS:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 28    Edit Message
                       */
                      case chatMessageVOTypes.EDIT_MESSAGE:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          chatEditMessageHandler(threadId, messageContent);
                          break;
  
                      /**
                       * Type 29    Delete Message
                       */
                      case chatMessageVOTypes.DELETE_MESSAGE:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
  
                          /**
                           * Remove Message from cache
                           */
                          if (canUseCache) {
                              if (db) {
                                  db.messages.where('id')
                                      .equals(messageContent)
                                      .and(function(message) {
                                          return message.owner == userInfo.id;
                                      })
                                      .delete()
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: 6602,
                                              message: CHAT_ERRORS[6602],
                                              error: error
                                          });
                                      });
                              }
                              else {
                                  fireEvent('error', {
                                      code: 6601,
                                      message: CHAT_ERRORS[6601],
                                      error: null
                                  });
                              }
                          }
  
                          fireEvent('messageEvents', {
                              type: 'MESSAGE_DELETE',
                              result: {
                                  message: {
                                      id: messageContent,
                                      threadId: threadId
                                  }
                              }
                          });
                          break;
  
                      /**
                       * Type 30    Thread Info Updated
                       */
                      case chatMessageVOTypes.THREAD_INFO_UPDATED:
                          var thread = formatDataToMakeConversation(messageContent);
                          /**
                           * Add Updated Thread into cache database #cache
                           */
                          if (canUseCache) {
                              if (db) {
                                  var tempData = {};
  
                                  try {
                                      var salt = Utility.generateUUID();
  
                                      tempData.id = thread.id;
                                      tempData.owner = userInfo.id;
                                      tempData.title = Utility.crypt(thread.title, cacheSecret, salt);
                                      tempData.time = thread.time;
                                      tempData.data = Utility.crypt(JSON.stringify(unsetNotSeenDuration(thread)), cacheSecret, salt);
                                      tempData.salt = salt;
                                  }
                                  catch (error) {
                                      fireEvent('error', {
                                          code: error.code,
                                          message: error.message,
                                          error: error
                                      });
                                  }
  
                                  db.threads.put(tempData)
                                      .catch(function(error) {
                                          fireEvent('error', {
                                              code: error.code,
                                              message: error.message,
                                              error: error
                                          });
                                      });
                              }
                              else {
                                  fireEvent('error', {
                                      code: 6601,
                                      message: CHAT_ERRORS[6601],
                                      error: null
                                  });
                              }
                          }
  
                          fireEvent('threadEvents', {
                              type: 'THREAD_INFO_UPDATED',
                              result: {
                                  thread: thread
                              }
                          });
                          break;
  
                      /**
                       * Type 31    Thread Last Seen Updated
                       */
                      case chatMessageVOTypes.LAST_SEEN_UPDATED:
                          if (fullResponseObject) {
                              getThreads({
                                  threadIds: [messageContent.conversationId]
                              }, function(threadsResult) {
                                  var threads = threadsResult.result.threads;
  
                                  if (!threadsResult.cache) {
                                      fireEvent('threadEvents', {
                                          type: 'THREAD_UNREAD_COUNT_UPDATED',
                                          result: {
                                              thread: threads[0],
                                              messageId: messageContent.messageId,
                                              senderId: messageContent.participantId
                                          }
                                      });
  
                                      fireEvent('threadEvents', {
                                          type: 'THREAD_LAST_ACTIVITY_TIME',
                                          result: {
                                              thread: threads[0]
                                          }
                                      });
                                  }
                              });
                          }
                          else {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_UNREAD_COUNT_UPDATED',
                                  result: {
                                      thread: threadId,
                                      messageId: messageContent.messageId,
                                      senderId: messageContent.participantId
                                  }
                              });
  
                              fireEvent('threadEvents', {
                                  type: 'THREAD_LAST_ACTIVITY_TIME',
                                  result: {
                                      thread: threadId
                                  }
                              });
                          }
  
                          break;
  
                      /**
                       * Type 32    Get Message Delivered List
                       */
                      case chatMessageVOTypes.GET_MESSAGE_DELEVERY_PARTICIPANTS:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 33    Get Message Seen List
                       */
                      case chatMessageVOTypes.GET_MESSAGE_SEEN_PARTICIPANTS:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
                          }
                          break;
  
                      /**
                       * Type 40    Bot Messages
                       */
                      case chatMessageVOTypes.BOT_MESSAGE:
                          fireEvent('botEvents', {
                              type: 'BOT_MESSAGE',
                              result: {
                                  bot: messageContent
                              }
                          });
                          break;
  
                      /**
                       * Type 41    Spam P2P Thread
                       */
                      case chatMessageVOTypes.SPAM_PV_THREAD:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
                          }
                          break;
  
                      /**
                       * Type 999   All unknown errors
                       */
                      case chatMessageVOTypes.ERROR:
                          if (messagesCallbacks[uniqueId]) {
                              messagesCallbacks[uniqueId](Utility.createReturnData(true, messageContent.message, messageContent.code, messageContent, 0));
                          }
  
                          /**
                           * If error code is 21 therefore Token is invalid &
                           * user should be logged put
                           */
                          if (messageContent.code == 21) {
                              // TODO: Temporarily removed due to unknown activity
                              // chatState = false;
                              // asyncClient.logout();
                              clearChatServerCaches();
                          }
  
                          fireEvent('error', {
                              code: messageContent.code,
                              message: messageContent.message,
                              error: messageContent
                          });
                          break;
                  }
              }