public HttpResponseMessage GetAllPublic(Guid userId) { HttpResponseMessage response; List <CPlaylistInfo> playlistsInfo = new List <CPlaylistInfo>(); try { List <CPlaylist> playlists = _playlistContext.GetAllPublic(userId).ToList(); foreach (CPlaylist playlist in playlists) { CPlaylistInfo playlistInfo = new CPlaylistInfo(); playlistInfo = playlist.ToCPlaylistInfo(); playlistsInfo.Add(playlistInfo); } response = Request.CreateResponse(HttpStatusCode.OK, playlistsInfo); return(response); } catch (Exception e)// in case program crashes? { HttpContext.Current.Response.StatusCode = (Int32)HttpStatusCode.BadRequest; throw new ContextException(e.Message, e); } }