public static async void FetchData() { // REMOVE FOR PERSISTENT Data Context.Database.EnsureDeleted(); // Ensure the Database is Created Context.Database.EnsureCreated(); // Set URL of api Manager to point to the Brands API // Load the Brands that Validate into the Local Storage List <Brand> brands = await APIManager.GetBrandsAsync(); try { Context.Brand.AttachRange(brands); Context.Brand.AddRange(brands); } catch (DbUpdateException exception) { Debug.WriteLine(exception.Message); Context.Brand.UpdateRange(brands); } finally { Context.ChangeTracker.DetectChanges(); Context.SaveChanges(); } // Load the Beverages that Validate into the Local Storage List <Beverage> beverages = await APIManager.GetBeveragesAsync(); try { Context.Beverage.AttachRange(beverages); Context.Beverage.AddRange(beverages); } catch (DbUpdateException exception) { Debug.WriteLine(exception.Message); Context.Beverage.UpdateRange(beverages); } finally { Context.ChangeTracker.DetectChanges(); Context.SaveChanges(); } // Release database resources //Context?.Dispose(); }