public async Task<IActionResult> CreateSmartApp(OauthInfo authInfo)
        {
            if (ModelState.IsValid == false)
                return View(authInfo);

            var conn = new SmartThingsConnection();
            if (await conn.Login(authInfo.STUserId, authInfo.STPassword) == false)
            {
                ModelState.AddModelError("STPassword", "Could not connect to smart things using the supplied credentials");
                return View("Index", authInfo);
            }

            var cs = new DeviceTypeRepository(conn, "j64 Alarm", $"{myEnv.WebRootPath}/../SmartThingApps/j64AlarmDevice.groovy");
            var ss = new DeviceTypeRepository(conn, "j64 Contact Zone", $"{myEnv.WebRootPath}/../SmartThingApps/j64ContactZoneDevice.groovy");
            var mz = new DeviceTypeRepository(conn, "j64 Motion Zone", $"{myEnv.WebRootPath}/../SmartThingApps/j64MotionZoneDevice.groovy");
            var pd = new DeviceTypeRepository(conn, "j64 Partition", $"{myEnv.WebRootPath}/../SmartThingApps/j64PartitionDevice.groovy");

            var jal = new SmartAppRepository(conn, "j64 Alarm", $"{myEnv.WebRootPath}/../SmartThingApps/j64AlarmSmartApp.groovy");

            // Save the client/secret keys
            var oauth = OauthRepository.Get();
            oauth.clientKey = jal.clientKey;
            oauth.secretKey = jal.secretKey;
            OauthRepository.Save(oauth);

            return View("Index", oauth);
        }
        public static OauthInfo Save(OauthInfo oai)
        {
            using (StreamWriter file = System.IO.File.CreateText(RepositoryFile))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Formatting = Formatting.Indented;
                serializer.Serialize(file, oai);
            }

            return oai;
        }