private async void HasAccess_ts_Toggled(object sender, RoutedEventArgs e)
        {
            ToggleSwitch clickedItem = (ToggleSwitch)e.OriginalSource;

            try
            {
                var item = clickedItem.DataContext;
                if (item.GetType() == typeof(Home))
                {
                    await HomeTable.Update(HomeConverter.CreateFrom((Home)item));
                }
                else if (item.GetType() == typeof(Room))
                {
                    await RoomTable.Update(RoomConverter.CreateFrom((Room)item));
                }
                else if (item.GetType() == typeof(Device))
                {
                    await DeviceTable.Update(DeviceConverter.CreateFrom((Device)item));
                }
                await Shared.Services.Storage.SyncAsync();
            }
            catch (Exception)
            {
            }
        }
        private async void UpdateHome()
        {
            await HomeTable.Update(HomeConverter.CreateFrom(SelectedHome));

            GetHomes();
            GetHome();
        }
        private async void DeleteHome()
        {
            SelectedHome.Deleted = true;
            await HomeTable.Update(HomeConverter.CreateFrom(SelectedHome));

            GetHome();
            GetHomes();
        }
        public static async Task <bool> CreateSampleHome(string homeName = "Railway House")
        {
            Home home = new Home
            {
                CreatedAt           = DateTime.Now,
                UpdatedAt           = DateTime.Now,
                OwnerId             = "sid:79cb2d8a9896fd48bac1f3969a9965cc",
                UserId              = "sid:79cb2d8a9896fd48bac1f3969a9965cc",
                HomeId              = "",
                HasAccess           = true,
                Name                = homeName,
                IsPrimary           = true,
                BackgroundUri       = "ms-appx:///Leaf.Shared/Images/DefaultHomeBackground.jpg",
                BackgroundOpacity   = 0.5,
                BackgroundBlur      = 20,
                IsLocationAvailable = false,
                Location            = "Castleconell",
                UserName            = "******",
                Deleted             = false
            };
            HomeItem item = HomeConverter.CreateFrom(home);
            await HomeTable.Create(item);

            item.HomeId = HomeTable.HomeItem.Id;
            await HomeTable.Update(item);


            //Home hom = (Home)home;
            //Home Home = new Home();
            //{
            //    Id = "0001",
            //    CreatedAt = "",
            //    UpdatedAt = "",
            //    Version = "",
            //    OwnerId = "",
            //    UserId = "",

            //    HomeId = "",
            //    Name = homeName,
            //    IsPrimary = true,
            //    Background = new Background
            //    {
            //        Uri = "ms-appx:///Leaf.Shared/Images/DefaultHomeBackground.jpg",
            //        Opacity = 0.4,
            //        Blur = 50
            //    },
            //    Location = new Location
            //    {
            //        IsLocationAvailable = true,
            //        Address = "Castleconnell"
            //    },
            //    Rooms = new ObservableCollection<Room>()
            //};
            //Room Room = CreateSampleRoom("0001", "Living Room");
            //Home.Rooms.Add(Room);
            //Room = CreateSampleRoom("0002", "Kitchen");
            //Home.Rooms.Add(Room);
            //Room = CreateSampleRoom("0003", "Bedroom");
            //Home.Rooms.Add(Room);
            //Room = CreateSampleRoom("0004", "Office");
            //Home.Rooms.Add(Room);
            //Room = CreateSampleRoom("0004", "Bathroom");
            //Home.Rooms.Add(Room);
            return(true);
        }