public ArtistAdministrationVM(IAdministrationServices services, IIOService ioService)
        {
            this.administrationService = services;
            this.ioService = ioService;
            Artists = new ObservableCollection<ArtistVM>();

            AddNewArtistCommand = new RelayCommand(s => {
                CurrentArtist = new ArtistVM(new Artist(),administrationService, ioService);
                Artists.Add(CurrentArtist);
                RaisePropertyChangedEvent(nameof(CurrentArtist));
                RaisePropertyChangedEvent(nameof(Artists));
            });

            AppMessages.ArtistChanged.Register(this, (type) =>
            {
                if(type == AppMessages.ChangeType.Remove)
                {
                    LoadArtists();
                }
                RaisePropertyChangedEvent(nameof(CurrentArtist));
                RaisePropertyChangedEvent(nameof(Artists));
            });

            AppMessages.CatagoryChanged.Register(this, (type) =>
            {
                this.LoadItems();
                RaisePropertyChangedEvent(nameof(Artists));
                RaisePropertyChangedEvent(nameof(Catagory));
            });

            LoadArtists();
        }
        public ArtistAdministrationVM(IAdministrationServices services, IIOService ioService)
        {
            this.administrationService = services;
            this.ioService             = ioService;
            Artists = new ObservableCollection <ArtistVM>();

            AddNewArtistCommand = new RelayCommand(s => {
                CurrentArtist = new ArtistVM(new Artist(), administrationService, ioService);
                Artists.Add(CurrentArtist);
                RaisePropertyChangedEvent(nameof(CurrentArtist));
                RaisePropertyChangedEvent(nameof(Artists));
            });


            AppMessages.ArtistChanged.Register(this, (type) =>
            {
                if (type == AppMessages.ChangeType.Remove)
                {
                    LoadArtists();
                }
                RaisePropertyChangedEvent(nameof(CurrentArtist));
                RaisePropertyChangedEvent(nameof(Artists));
            });

            AppMessages.CatagoryChanged.Register(this, (type) =>
            {
                this.LoadItems();
                RaisePropertyChangedEvent(nameof(Artists));
                RaisePropertyChangedEvent(nameof(Catagory));
            });

            LoadArtists();
        }
        private void LoadArtists()
        {
            Artists.Clear();
            IList <Artist> artists = administrationService.GetArtists();

            foreach (Artist artist in artists)
            {
                Artists.Add(new ArtistVM(artist, this.administrationService, ioService));
            }
            CurrentArtist = Artists.First();
            var view = CollectionViewSource.GetDefaultView(Artists);

            view.GroupDescriptions.Clear();
            view.GroupDescriptions.Add(new PropertyGroupDescription("Catagory.Name"));
        }
 private void LoadArtists()
 {
     Artists.Clear();
         IList<Artist> artists = administrationService.GetArtists();
         foreach (Artist artist in artists)
         {
             Artists.Add(new ArtistVM(artist, this.administrationService, ioService));
         }
         CurrentArtist = Artists.First();
         var view = CollectionViewSource.GetDefaultView(Artists);
         view.GroupDescriptions.Clear();
         view.GroupDescriptions.Add(new PropertyGroupDescription("Catagory.Name"));
 }