public function deletePlaylistAction(Request $request, $id)
{
$user = $this->container->get('user')->getCurrentUser();
if (!$user->hasPermission('ManagePlaylist')) {
throw new AccessDeniedException('You do not have the right to manage playlists.');
}
$em = $this->container->get('em');
$playlist = $em->getRepository('Newscoop\\Entity\\Playlist')->getPlaylist($id)->getOneOrNullResult();
if (!$playlist) {
throw new NotFoundHttpException('Result was not found.');
}
$em->remove($playlist);
$em->flush();
}