async void ExecuteAddUpgradeAsync(object obj)
        {
            var nav = DependencyService.Get <INavigationService>();

            var vm = new AddUpgradeViewModel(this);

            await nav.Navigate(vm);
        }
        async void ExecuteEditUpgradeAsync(object obj)
        {
            var vm = obj as AddUpgradeViewModel;

            if (vm != null)
            {
                var edit = new AddUpgradeViewModel(this, vm.GetModel());
                var nav  = DependencyService.Get <INavigationService>();
                await nav.Navigate(edit);
            }
        }
        void OnUpgradeSaved(AddUpgradeViewModel obj)
        {
            var match = this.Upgrades.FirstOrDefault(x => x.Id == obj.Id);

            if (match != null)
            {
                var idx = this.Upgrades.IndexOf(match);

                this.Upgrades.RemoveAt(idx);
                this.Upgrades.Insert(idx, obj);
            }
            else if (obj.Vehicle == this)
            {
                this.Upgrades.Add(obj);
            }

            this.RaiseAllPropertiesChanged();
        }
        // restore data
        public AddVehicleViewModel(AddTeamViewModel team, UserVehicle userVehicle) : this(team)
        {
            this.Id   = userVehicle.Id;
            this.Name = userVehicle.VehicleName;

            this.VehicleType = new SelectVehicleViewModel(this, userVehicle.VehicleType);

            //this.SelectedVehicleType = this.VehicleTypes.FirstOrDefault(x => x.vtype == userVehicle.VehicleType?.vtype);

            this.Weapons.Clear();
            foreach (var w in userVehicle.Weaposn)
            {
                var vm = new AddWeaponViewModel(this, w);
                this.Weapons.Add(vm);
            }

            this.Perks.Clear();
            foreach (var p in userVehicle.Perks)
            {
                var vm = new AddPerkViewModel(this, p);
                this.Perks.Add(vm);
            }

            this.Upgrades.Clear();
            foreach (var u in userVehicle.Upgrades)
            {
                var vm = new AddUpgradeViewModel(this, u);
                this.Upgrades.Add(vm);
            }

            this.Trailers.Clear();
            foreach (var t in userVehicle.Trailers)
            {
                var vm = new AddTrailerViewModel(this, t.Trailer, t.Cargo);
                this.Trailers.Add(vm);

                // run trailer support logic
                this.AddTrailerSupport();
            }

            // todo: restore
        }