public PlaylistDto Create(PlaylistDto playlistDto)
        {
            PlaylistDto savedPlaylistDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                User user = UserManager.Get(playlistDto.UserId);

                Playlist playlist = new Playlist(playlistDto.Id, playlistDto.Sequence, playlistDto.Title);
                user.AddPlaylist(playlist);

                playlist.AddItems(playlistDto.Items.Select(dto => new PlaylistItem(dto.Id, dto.Sequence, dto.Title, dto.Cid, dto.Song.Id, dto.Song.Type, dto.Song.Title, dto.Song.Duration, dto.Song.Author)));

                //  Make sure the playlist has been setup properly before it is cascade-saved through the User.
                playlist.ValidateAndThrow();

                PlaylistManager.Save(playlist);

                savedPlaylistDto = PlaylistDto.Create(playlist);

                transaction.Commit();
            }

            return savedPlaylistDto;
        }
        public PlaylistDto Create(PlaylistDto playlistDto)
        {
            PlaylistDto savedPlaylistDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                User user = UserManager.Get(playlistDto.UserId);

                Playlist playlist = new Playlist(playlistDto.Id);
                playlistDto.SetPatchableProperties(playlist);

                user.AddPlaylist(playlist);

                List<PlaylistItem> playlistItems = new List<PlaylistItem>();
                foreach (PlaylistItemDto dto in playlistDto.Items)
                {
                    PlaylistItem playlistItem = new PlaylistItem(dto.Id, dto.Title, dto.Cid, dto.Song.Id, dto.Song.Type, dto.Song.Title, dto.Song.Duration, dto.Song.Author);
                    dto.SetPatchableProperties(playlistItem);
                    playlistItems.Add(playlistItem);
                }
                playlist.AddItems(playlistItems);

                PlaylistManager.Save(playlist);
                savedPlaylistDto = PlaylistDto.Create(playlist);

                transaction.Commit();
            }

            return savedPlaylistDto;
        }