public OrderViewModel() { Title = "New order"; Clients = DataStore.GetClientsAsync().Result.ToList(); Items = new ObservableCollection <Item>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", async(obj, item) => { var newItem = item as Item; Items.Add(newItem); await DataStore.AddItemAsync(newItem); }); MessagingCenter.Subscribe <ItemsPage, Item>(this, "QuantityChanged", async(obj, item) => { var newItem = item as Item; await DataStore.UpdateItemAsync(newItem); LoadItemsCommand.Execute(null); }); MessagingCenter.Subscribe <ItemsPage, Item>(this, "DeleteItem", async(obj, item) => { var newItem = item as Item; await DataStore.DeleteItemAsync(newItem.Id); LoadItemsCommand.Execute(null); }); MessagingCenter.Subscribe <LogInPage, Distributor>(this, "LogIn", async(obj, dist) => { var newDistibutor = dist as Distributor; await DataStore.AddDistributorAsync(newDistibutor); DataTransformer.SaveClientsToDB(DataRequester.MakeRequest(RequestTo.GetClients, newDistibutor.DistributorId.ToString())); }); }