public GetDetailsResult GetDetails(GetDetailsRequest request) { try { Domain.Objects.Track track; List <Domain.Objects.Scrobble> scrobbles; using (DAL.DALManager mgr = new DAL.DALManager(settings.Value.DatabasePath)) { track = mgr.Get <Domain.Objects.Track>(int.Parse(request.TrackId)); scrobbles = mgr.GetScrobblesOfTrack(track.Id); } if (track == null) { return new GetDetailsResult() { Success = false, Message = "Track not found" } } ; return(new GetDetailsResult() { Success = true, Details = new TrackDetails() { Id = track.Id + "", Title = track.Title, Album = track.Album, Artists = track.Artists?.Split(','), Genres = System.Text.RegularExpressions.Regex.Split(track.Genres + "", "[,/]"), TrackNr = track.TrackNr, AddedOn = track.AddedOn, LastPlayed = track.LastPlayed == DateTime.MinValue ? null : (DateTime?)track.LastPlayed, Liked = track.LikeStatus, NrPlayed = track.NrPlayed, NrPlayedToEnd = track.NrPlayedToEnd, LastScrobbles = scrobbles.OrderByDescending(s => s.On).Select(s => new TrackScrobble() { On = s.On, PlayedToEnd = s.PlayedToEnd }).ToArray() } }); } catch (Exception ex) { return(GetErrorResultFromException <GetDetailsResult>(ex)); } }