public Experiment RetrieveExperiment(long experimentID)
        {
            Experiment experiment = null;
            BrokerDB brokerDB = new BrokerDB();
            int roles = 0;
            int userID = 0;
            int groupID = 0;
            //long[] expIDs = null;
            Ticket expTicket = brokerDB.RetrieveTicket(opHeader.coupon, TicketTypes.REDEEM_SESSION);
            if (expTicket != null && !expTicket.IsExpired())
            {
                //Parse payload, only get what is needed

                XmlQueryDoc expDoc = new XmlQueryDoc(expTicket.payload);
                //long expID = -1;

                string userStr = expDoc.Query("RedeemSessionPayload/userID");
                if ((userStr != null) && (userStr.Length > 0))
                    userID = Convert.ToInt32(userStr);
                string groupStr = expDoc.Query("RedeemSessionPayload/groupID");
                if ((groupStr != null) && (groupStr.Length > 0))
                    groupID = Convert.ToInt32(groupStr);

                if (userID > 0)
                {

                    AuthorizationWrapperClass wrapper = new AuthorizationWrapperClass();
                    roles = wrapper.GetExperimentAuthorizationWrapper(experimentID, userID, groupID);
                }
                if ((roles | ExperimentAccess.READ) == ExperimentAccess.READ)
                {
                    experiment = new Experiment();
                    experiment.experimentId = experimentID;
                    experiment.issuerGuid = ProcessAgentDB.ServiceGuid;
                    ProcessAgentInfo ess = brokerDB.GetExperimentESS(experimentID);
                    if (ess != null)
                    {
                        ExperimentStorageProxy essProxy = new ExperimentStorageProxy();
                        Coupon opCoupon = brokerDB.GetEssOpCoupon(experimentID, TicketTypes.RETRIEVE_RECORDS, 60, ess.agentGuid);
                        if (opCoupon == null)
                        {
                            string payload = TicketLoadFactory.Instance().RetrieveRecordsPayload(experimentID, ess.webServiceUrl);
                            opCoupon = brokerDB.CreateTicket(TicketTypes.RETRIEVE_RECORDS, ess.agentGuid, ProcessAgentDB.ServiceGuid,
                                60, payload);
                        }
                        essProxy.OperationAuthHeaderValue = new OperationAuthHeader();
                        essProxy.OperationAuthHeaderValue.coupon = opCoupon;
                        essProxy.Url = ess.webServiceUrl;
                        essProxy.GetRecords(experimentID, null);
                    }

                }
                else
                {
                    throw new AccessDeniedException("You do not have permission to read this experiment");
                }
            }
            return experiment;
        }