async void ConnectBridgeClicked(object sender, EventArgs e)
        {
            IBridgeLocator       locator   = new HttpBridgeLocator();
            IEnumerable <string> bridgeIPs = await locator.LocateBridgesAsync(TimeSpan.FromSeconds(5));

            IpAddress = bridgeIPs.FirstOrDefault();

            client = new LocalHueClient(IpAddress);

            var appKey = new HueAppKey {
                AppId = await client.RegisterAsync("pooberry", "iphone")
            };
            var bridgeIp = new HueBridge {
                HueBridgeIpAddress = IpAddress
            };

            var conn = new SQLite.SQLiteConnection(_pathToDatabase);

            //set up bridge table
            conn.CreateTable <HueBridge> ();
            conn.DeleteAll <HueBridge> ();

            //set up app key table
            conn.CreateTable <HueAppKey> ();
            conn.DeleteAll <HueAppKey> ();

            //insert app key and bridge ip into database
            var db = new SQLite.SQLiteConnection(_pathToDatabase);

            db.Insert(bridgeIp);
            db.Insert(appKey);

            var alert = new UIAlertView("Success!", "Feel free to play with your lights!", null, "OK");

            alert.Show();
        }
		async void ConnectBridgeClicked (object sender, EventArgs e)
		{
			IBridgeLocator locator = new HttpBridgeLocator ();
			IEnumerable<string> bridgeIPs = await locator.LocateBridgesAsync (TimeSpan.FromSeconds (5));

			IpAddress = bridgeIPs.FirstOrDefault ();

			client = new LocalHueClient (IpAddress);

			var appKey = new HueAppKey{ AppId = await client.RegisterAsync ("pooberry", "iphone") };
			var bridgeIp = new HueBridge { HueBridgeIpAddress = IpAddress };

			var conn = new SQLite.SQLiteConnection (_pathToDatabase);
			//set up bridge table
			conn.CreateTable<HueBridge> ();
			conn.DeleteAll<HueBridge> ();

			//set up app key table
			conn.CreateTable<HueAppKey> ();
			conn.DeleteAll<HueAppKey> ();

			//insert app key and bridge ip into database
			var db = new SQLite.SQLiteConnection (_pathToDatabase);
			db.Insert (bridgeIp);
			db.Insert (appKey);

			var alert = new UIAlertView ("Success!", "Feel free to play with your lights!", null, "OK");		
			alert.Show ();	
		}