public AlbumListViewModel(Group group)
        {
            Title = ProfileService.StoredDisciple?.PreferName ?? "Welcome";

            CurrentGroup = group;
            LoadCommand  = new Command(() => ExecuteLoadCommand());

            MessagingCenter.Subscribe <Album>(this, "upsert", async album => {
                album.GroupId = group.Id;
                album         = await dataService.UpsertAsync(album);
                if (group.Albums == null)
                {
                    group.Albums = new List <Album>();
                }
                group.Albums.Upsert(album);
                Albums.Upsert(album);
                OnPropertyChanged("HasAlbums");
                OnPropertyChanged("NoAlbums");
            });

            MessagingCenter.Subscribe <Album>(this, "delete", async album => {
                await dataService.Delete(album);
                group.Albums.Remove(album);
                Albums.Delete(album);
                OnPropertyChanged("HasAlbums");
                OnPropertyChanged("NoAlbums");
            });
        }
        public AlbumListViewModel(Group group)
        {
            if (group == null)
            {
                throw new ApplicationException("No group set for album list");
            }

            Title = group.Name;

            LoadCommand = new Command(() => {
                if (IsBusy)
                {
                    return;
                }

                IsBusy = true;

                if (group == null)
                {
                    IsBusy = false;
                    return;
                }

                try {
                    Albums.Clear();
                    group.Albums.ForEach(p => Albums.Add(p));
                    OnPropertyChanged("IsListEmpty");
                } catch (Exception ex) {
                    Debug.WriteLine(ex);
                } finally {
                    IsBusy = false;
                }
            });

            MessagingCenter.Subscribe <Album>(this, "upsert", async album => {
                album.GroupId = group.Id;
                album         = await dataService.UpsertAsync(album);
                if (group.Albums == null)
                {
                    group.Albums = new List <Album>();
                }
                group.Albums.Upsert(album);
                Albums.Upsert(album);
                OnPropertyChanged("IsListEmpty");
            });

            MessagingCenter.Subscribe <Album>(this, "delete", async album => {
                await dataService.Delete(album);
                group.Albums.Remove(album);
                Albums.Delete(album);
                OnPropertyChanged("IsListEmpty");
            });

            LoadCommand.Execute(null);
        }
        /// <summary>
        ///		Borra un archivo
        /// </summary>
        public bool Delete(MediaFileModel file)
        {
            bool deleted = Albums.Delete(file);

            // Borra la entrada de las carpetas
            if (!deleted)
            {
                deleted = Folders.Delete(file);
            }
            // Devuelve el valor que indica si se ha borrado
            return(deleted);
        }