public long GetExternalReportKey(DR_Requester requester, int reportID, int entityID, DP_SearchRepository searchItem)
        {
            BizEntityExternalReport bizEntityExternalReport = new BizEntityExternalReport();
            BizTableDrivedEntity    bizTableDrivedEntity    = new BizTableDrivedEntity();
            SearchRequestManager    searchRequestManager    = new SearchRequestManager();
            var query  = searchRequestManager.GetSelectFromExternal(requester, entityID, searchItem, true);
            var entity = bizTableDrivedEntity.GetSimpleEntity(requester, entityID);

            if (query != null)
            {
                //  var transactionresult = ConnectionManager.ExecuteTransactionalQueryItems(allQueryItems.Where(x => !string.IsNullOrEmpty(x.Query)).ToList());

                //var guid = Guid.NewGuid().ToString();
                var id = 0;
                using (var model = new MyIdeaDataDBEntities())
                {
                    var newItem = new ExternalReportKeys();
                    newItem.DateTime    = DateTime.Now;
                    newItem.RequesterID = requester.Identity;
                    newItem.ReportID    = reportID;
                    model.ExternalReportKeys.Add(newItem);
                    model.SaveChanges();
                    id = newItem.ID;
                }
                if (id != 0)
                {
                    var inserted = bizEntityExternalReport.InsertDataIntoExternalReportTable(requester, reportID, entityID, id, query.Item2);

                    if (inserted)
                    {
                        return(id);
                    }
                }
            }
            return(0);
        }