public OrganizationChartPositionsVM(OrganizationChartVM organizationChart, AccessType access):base(access)
        {
            UnitOfWork = new SoheilEdmContext();
            CurrentOrganizationChart = organizationChart;
            OrganizationChartDataService = new OrganizationChartDataService(UnitOfWork);
            OrganizationChartDataService.PositionAdded += OnPositionAdded;
            OrganizationChartDataService.PositionRemoved += OnPositionRemoved;
            PositionDataService = new PositionDataService(UnitOfWork);
            OrganizationChartPositionDataService = new OrganizationChartPositionDataService(UnitOfWork);

            RootNode = new OrganizationChartPositionVM(Access, OrganizationChartPositionDataService) { Title = string.Empty, Id = -1, ParentId = -2 };

            var selectedVms = new ObservableCollection<OrganizationChartPositionVM>();
            foreach (var organizationChartPosition in OrganizationChartDataService.GetPositions(organizationChart.Id))
            {
                selectedVms.Add(new OrganizationChartPositionVM(organizationChartPosition, Access, OrganizationChartPositionDataService));
            }

            var allVms = new ObservableCollection<PositionVM>();
            foreach (var position in PositionDataService.GetActives(SoheilEntityType.OrganizationCharts, CurrentOrganizationChart.Id))
            {
                allVms.Add(new PositionVM(position, Access, PositionDataService));
            }
            AllItems = new ListCollectionView(allVms);

            IncludeCommand = new Command(Include, CanInclude);
            ExcludeTreeCommand = new Command(ExcludeTree, CanExcludeTree);


            foreach (OrganizationChartPositionVM item in selectedVms)
            {
                if (item.ParentId == RootNode.Id)
                {
                    RootNode.ChildNodes.Add(item);
                    break;
                }
            }

            CurrentNode = RootNode;
        }
        private void OnPositionAdded(object sender, ModelAddedEventArgs<OrganizationChart_Position> e)
        {
            var positionOrganizationChartVm = new OrganizationChartPositionVM(e.NewModel, Access, OrganizationChartPositionDataService);
            CurrentNode.ChildNodes.Add(positionOrganizationChartVm);

            if (CurrentNode == RootNode)
            {
                CurrentNode = positionOrganizationChartVm;
            }
        }
 private void OnOrganizationChartAdded(object sender, ModelAddedEventArgs<OrganizationChart_Position> e)
 {
     var organizationChartPositionVm = new OrganizationChartPositionVM(e.NewModel, Access, OrganizationChartPositionDataService);
     SelectedItems.AddNewItem(organizationChartPositionVm);
     SelectedItems.CommitNew();
 }