public IHttpActionResult GetMessageByCompanyId(int id, [FromUri] int top = 10, [FromUri] int hours = 168, [FromUri] string order = "desc")
        {
            try
            {
                CompanyModel companyModel          = new CompanyModel();
                CompanyModel.Format_Detail company = companyModel.GetById(id);

                var companySubscription = companyModel.GetValidSubscriptionPlanByCompanyId(id);
                if (companySubscription == null)
                {
                    throw new Exception("can't find valid subscription plan.");
                }

                DocumentDBHelper docDBHelpler = new DocumentDBHelper(id, companySubscription.CosmosDBConnectionString);
                return(Ok(docDBHelpler.GetMessageByCompanyId(id, top, hours, order)));
            }
            catch (Exception ex)
            {
                StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex);
                string        logAPI     = "[Get] " + Request.RequestUri.ToString();
                Global._appLogger.Error(logAPI + logMessage);

                return(Content(HttpStatusCode.InternalServerError, ex));
            }
        }
        public IHttpActionResult GetMessageByCompanyId(int id, [FromUri] int top = 10, [FromUri] int hours = 168, [FromUri] string order = "desc")
        {
            try
            {
                CompanyModels        companyModel = new CompanyModels();
                CompanyModels.Detail company      = companyModel.getCompanyById(id);
                DocumentDBHelper     docDBHelpler = new DocumentDBHelper(id, company.DocDBConnectionString);
                return(Ok(docDBHelpler.GetMessageByCompanyId(id, top, hours, order)));
            }
            catch (Exception ex)
            {
                StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex);
                string        logAPI     = "[Get] " + Request.RequestUri.ToString();
                Startup._sfAppLogger.Error(logAPI + logMessage);

                return(InternalServerError(ex));
            }
        }