public JsonResult CreateCustomPlaylist(string AccessToken, string UserId, string TrackStringList, string PlaylistName) { CreatedPlaylist playlist = APICalls.CreateNewPlaylist(AccessToken, UserId, PlaylistName); TrackList tracklist = APICalls.GetTracks(AccessToken, TrackStringList); string URIString = ""; foreach (Track t in tracklist.tracks) { URIString += t.uri + ","; } URIString = URIString.Trim(','); AddSongs added = APICalls.AddSongsToPlaylist(AccessToken, UserId, playlist.id, URIString); return(Json(new { PlaylistId = playlist.id, TrackIdList = TrackStringList.Trim(',') })); }