public static PlanoComercialViewModel From(PlanoComercial planoComercial, IRepositorioDePlanosComerciais repositorioDePlanosComerciais, IRepositorioDeModelos repositorioDeModelos)
        {
            var custos = planoComercial.Custos.Select(p => CustoViewModel.From(p)).ToList();

            var custosObservableCollection = new CustosObservableCollection(custos);

            var itensDePlanoComercial = planoComercial.Itens.Select(p => ItemDePlanoComercialViewModel.From(p, repositorioDePlanosComerciais, repositorioDeModelos)).ToList();

            var itensDePlanoComercialObservableCollection = new ItensDePlanoComercialObservableCollection(repositorioDePlanosComerciais, repositorioDeModelos);

            var viewModel = new PlanoComercialViewModel
            {
                model = planoComercial as PlanoComercial,
                //Id = planoComercial.Id,
                nome             = planoComercial.Nome,
                RendaBrutaMensal = planoComercial.RendaBrutaMensal,
                Custos           = custosObservableCollection,
                Itens            = itensDePlanoComercialObservableCollection
            };

            custosObservableCollection.planoComercial = viewModel;

            itensDePlanoComercialObservableCollection.planoComercial = viewModel;

            return(viewModel);
        }
        public PlanoComercialViewModel()
        {
            Custos = new CustosObservableCollection(new List <CustoViewModel>()
            {
            });

            Custos.planoComercial = this;

            Itens = new ItensDePlanoComercialObservableCollection(repositorioDePlanosComerciais, repositorioDeModelos);

            Itens.planoComercial = this;
        }