docs: function(threadId, messageContent) {
  
                  var message = formatDataToMakeMessage(threadId, messageContent);
                  deliver({
                      messageId: message.id,
                      ownerId: message.participant.id
                  });
  
                  /**
                   * Add New Messages into cache database
                   */
                  if (canUseCache) {
                      if (db) {
                          /**
                           * Insert new messages into cache database
                           * after deleting old messages from cache
                           */
                          var tempData = {};
  
                          try {
                              var salt = Utility.generateUUID();
                              tempData.id = parseInt(message.id);
                              tempData.owner = parseInt(userInfo.id);
                              tempData.threadId = parseInt(message.threadId);
                              tempData.time = message.time;
                              tempData.message = Utility.crypt(message.message, cacheSecret, salt);
                              tempData.data = Utility.crypt(JSON.stringify(unsetNotSeenDuration(message)), cacheSecret, salt);
                              tempData.salt = salt;
                              tempData.sendStatus = 'sent';
  
                          }
                          catch (error) {
                              fireEvent('error', {
                                  code: error.code,
                                  message: error.message,
                                  error: error
                              });
                          }
  
                          db.messages.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('messageEvents', {
                      type: 'MESSAGE_NEW',
                      result: {
                          message: message
                      }
                  });
  
                  if (fullResponseObject) {
                      getThreads({
                          threadIds: [threadId]
                      }, function(threadsResult) {
                          var threads = threadsResult.result.threads;
  
                          if (messageContent.participant.id !== userInfo.id && !threadsResult.cache) {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_UNREAD_COUNT_UPDATED',
                                  result: {
                                      thread: threads[0],
                                      messageId: messageContent.id,
                                      senderId: messageContent.participant.id
                                  }
                              });
                          }
  
                          if (!threadsResult.cache) {
                              fireEvent('threadEvents', {
                                  type: 'THREAD_LAST_ACTIVITY_TIME',
                                  result: {
                                      thread: threads[0]
                                  }
                              });
                          }
                      });
                  }
                  else {
                      fireEvent('threadEvents', {
                          type: 'THREAD_LAST_ACTIVITY_TIME',
                          result: {
                              thread: threadId
                          }
                      });
                  }
  
                  /**
                   * Update waitQ and remove sent messages from it
                   */
                  if (hasCache && typeof queueDb == 'object') {
                      queueDb.waitQ.where('uniqueId')
                          .equals(message.uniqueId)
                          .and(function(item) {
                              return item.owner == parseInt(userInfo.id);
                          })
                          .delete()
                          .catch(function(error) {
                              fireEvent('error', {
                                  code: error.code,
                                  message: error.message,
                                  error: error
                              });
                          });
                  }
                  else {
                      for (var i = 0; i < chatSendQueue.length; i++) {
                          if (chatSendQueue[i].uniqueId == message.uniqueId) {
                              chatSendQueue.splice(i, 1);
                          }
                      }
                  }
              }