public ActionResult Index(CernerOAuth2ViewModels lvm)
        {
            CernerAuth myCernerAuth = TokenGettingStuff();

            try
            {
                CernerFullConnectionInformationViewModel cfcivm = new CernerFullConnectionInformationViewModel
                {
                    AccessToken  = myCernerAuth.access_token,
                    RefreshToken = myCernerAuth.refresh_token,

                    PatientId = myCernerAuth.patient,

                    ServiceUrl = myCernerHelper.cci.ServiceUrl
                };

                FraminghamCalculatorViewModel fcvm = FraminghamCalculator(cfcivm);

                return(View("FraminghamCalculator", fcvm));
            }
            catch (Exception ex)
            {
                myCernerHelper.cci.ErrorCorrelationId = myCernerAuth.CorrelationId;

                return(View("CernerHelper", myCernerHelper.cci));
            }
        }
        //public ActionResult Launch(CernerOAuth2ViewModels lvm)
        public ActionResult Launch()
        {
            ViewBag.Message = "Framingham Calculator Launch Page";

            string serviceUri      = Request.Params["iss"];
            string launchContextId = Request.Params["launch"];

            CernerOAuth2ViewModels lvm = PhillLVM(serviceUri, launchContextId);

            return(View(lvm));
        }
        /// <summary>
        /// Given the ServiceURI and the LaunchContexID we can ask the cerner authentication server
        /// for the rest of the information we're going to need to pass further down the line.
        /// </summary>
        /// <param name="serviceUri"></param>
        /// <param name="launchContextId"></param>
        /// <returns></returns>
        private CernerOAuth2ViewModels PhillLVM(string serviceUri, string launchContextId)
        {
            CernerOAuth2ViewModels lvm = new CernerOAuth2ViewModels();

            myCernerHelper.GetMetaData(launchContextId);

            lvm.ClientId = ClientID;

            // For demonstration purposes, if you registered a confidential client
            // you can enter its secret here. The demo app will pretend it's a confidential
            // app (in reality it cannot be confidential, since it cannot keep secrets in the
            // browser)
            // set me, if confidential
            lvm.Secret = AppSecret;


            //I'm going to just get this here so I have it. Not sure I will need it.
            // These parameters will be received at launch time in the URL

            lvm.Scopes = string.Join(" ", Scopes);

            //Generate a unique ID for this session.
            lvm.State = Guid.NewGuid();

            lvm.ServiceUri = serviceUri;

            lvm.LaunchContextId = launchContextId;

            lvm.RedirectUri = RedirctUriBuilder();

            lvm.LaunchUri = lvm.RedirectUri + "Launch";

            lvm.ConformanceUri = uriAppBase + "/metadata";



            //lvm.AuthUri = Authority;
            //lvm.TokenUri = TokenUri;

            lvm.AuthUri  = myCernerHelper.cci.AuthorizeUrl;
            lvm.TokenUri = myCernerHelper.cci.TokenUrl;

            //Make up that full redirect href
            lvm.RedirectHref = lvm.AuthUri
                               + "?" +
                               "response_type=code&" +
                               "client_id=" + HttpUtility.UrlEncode(lvm.ClientId) + "&" +
                               "scope=" + HttpUtility.UrlEncode(lvm.Scopes) + "&" +
                               "redirect_uri=" + HttpUtility.UrlEncode(lvm.RedirectUri) + "&" +
                               "aud=" + HttpUtility.UrlEncode(lvm.ServiceUri) + "&" +
                               "launch=" + lvm.LaunchContextId + "&" +
                               "state=" + lvm.State.ToString();

            //*authUri + "?" +
            //       "response_type=code&" +
            //       "client_id=" + encodeURIComponent('@Model.ClientId') + "&" +
            //       "scope=" + encodeURIComponent('@Model.Scopes') + "&" +
            //       "redirect_uri=" + encodeURIComponent('@Model.RedirectUri') + "&" +
            //       "aud=" + encodeURIComponent('@Model.ServiceUri') + "&" +
            //       "launch=" + '@Model.LaunchContextId' + "&" +
            //       "state=" + '@Model.State.ToString()';



            return(lvm);
        }