public GetPlayerStateResult PlayPlaylistNow([FromBody] PlayPlaylistRequest request) { if (request.PlaylistId == Player.Instance.CurrentPlaylist.Id + "") { return new GetPlayerStateResult() { Success = false, Message = "Already playing this playlist" } } ; using (DAL.DALManager mgr = new DAL.DALManager(settings.Value.DatabasePath)) { if (request.PlaylistId == (Domain.Objects.Playlist.ALL_ID + "") || request.PlaylistId == (Domain.Objects.Playlist.LIKED_ID + "")) { Player.Instance.LoadPlaylist(new Player.Playlist() { Id = int.Parse(request.PlaylistId), // all or liked so no fetching of playlist object Tracks = mgr.GetTrackItems(int.Parse(request.PlaylistId)), }); } else { var playlist = mgr.Get <Domain.Objects.Playlist>(int.Parse(request.PlaylistId)); if (playlist == null) { return new GetPlayerStateResult() { Success = false, Message = "Playlist not found" } } ; Player.Instance.LoadPlaylist(new Player.Playlist() { Id = playlist.Id, Tracks = mgr.GetTrackItems(playlist.Id), }); } } return(GetPlayerStateResultFromPlayer <GetPlayerStateResult>()); }