/// <summary>
        /// 
        /// </summary>
        /// <param name="playlist"></param>
        /// <param name="song"></param>
        /// <returns></returns>
        public bool addSongToPlaylist(Playlist playlist, Song song)
        {
            try
            {
                // Call to initialise cluster connection
                //init();

                // Connect to cluster
                ISession session = cluster.Connect("maltmusic");

                // Prepare and bind statement passing in the relevant fields
                String todo = ("insert into playlist (track_id,playlist_id,track_pos)\n" +
                 "values (:tid, :pid,:tpos) if not exists;");
                PreparedStatement ps = session.Prepare(todo);

                // Getting Appropriate ID's for query
                Guid tid = song.getSongID();
                Guid pid = playlist.getID();

                // Matt - change this
                // done
                int pos = getListPos(session, tid, pid);

                BoundStatement bs = ps.Bind(tid, pid, pos);

                // Execute Query
                session.Execute(bs);

                return true;

                // Catch exceptions
            }
            catch (Exception ex)
            {
                Console.WriteLine("SOMETHING WENT WRONG add to playlist: " + ex.Message);
                return false;
            }
        }
        public bool addToTempPlaylist(Playlist playlist,ISession session)
        {
            try
            {
                // Prepare and bind statement passing in the relevant fields
                String todo = ("insert into playlist (track_id,playlist_id,track_pos)\n" +
                 "values (:tid, :pid,:tpos) if not exists using ttl 3600;");
                PreparedStatement ps = session.Prepare(todo);

                // Getting Appropriate ID's for query
                Guid pid = playlist.getID();

                List<Song> songs = playlist.getSongs();

                for (int i = 0; i < songs.Count(); i++)
                {
                    Guid tid = songs[i].getSongID();
                    int pos = getListPos(session, tid, pid);
                    BoundStatement bs = ps.Bind(tid, pid, pos);
                    // Execute Query
                    session.Execute(bs);
                }

                return false;
                // Catch exceptions
            }
            catch (Exception ex)
            {
                Console.WriteLine("SOMETHING WENT WRONG add to temp playlist: " + ex.Message);
                return false;
            }
        }
        //
        public void renamePlaylist(Playlist playlist, String newName)
        {
            try
            {
                //init();
                // Connect to cluster
                ISession session = cluster.Connect("maltmusic");

                // get playlist id and owner
                Guid play_id = playlist.getID();
                String owner = playlist.getOwner();

                // Delete Playlist with old name
                String todo = "delete from list_playlist WHERE playlist_id = :pid";
                PreparedStatement ps = session.Prepare(todo);
                BoundStatement bs = ps.Bind(play_id);
                session.Execute(bs);

                // Recreate playlist with new name, same old id
                // Slightly hacky way of updating a primary key
                String insert = "insert into list_playlist (\n" +
                      "playlist_id, owner,playlist_name)\n" +
                     "values (:pid,:own,:plnm) if not exists";
                PreparedStatement preps = session.Prepare(insert);
                BoundStatement bounds = preps.Bind(play_id, owner, newName);
                session.Execute(bounds);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Renaming a plist broke " + ex);
            }
        }
        public void removeSongFromPlaylist(Playlist playlist, Song song)
        {
            try
            {
                //init();
                // Connect to cluster
                ISession session = cluster.Connect("maltmusic");

                // get playlist id
                // get track id
                Guid play_id = playlist.getID();
                Guid track_id = song.getSongID();

                String todo = "delete from playlist where playlist_id = :pid and track_id = :tid";
                PreparedStatement ps = session.Prepare(todo);
                BoundStatement bs = ps.Bind(play_id, track_id);
                session.Execute(bs);
            }
            catch (Exception e)
            {
                Console.WriteLine("Removing from a plist broke " + e);
            }
        }
        public void populatePlaylist(Playlist p, List<Song> s)
        {
            try
            {
                // Call to initialise cluster connection
                //init();
                // Connect to cluster
                ISession session = cluster.Connect("maltmusic");

                Guid pid = p.getID();

                // Prepare and bind statement passing in the relevant fields
                String todo = ("insert into playlist (track_id,playlist_id,track_pos)\n" +
                 "values (:tid, :pid,:tpos) if not exists;");
                PreparedStatement ps = session.Prepare(todo);
                Guid tid = new Guid();
                for (int i = 0; i < s.Count; i++)
                {
                    tid = s[i].getSongID();
                    int pos = getListPos(session, tid, pid);
                    BoundStatement bs = ps.Bind(tid, pid, pos);

                    // Execute Query
                    session.Execute(bs);
                }
                // Catch exceptions
            }
            catch (Exception ex)
            {
                Console.WriteLine("SOMETHING WENT WRONG populate playlist: " + ex.Message);
                //return false;
            }
        }
        public void deletePlaylist(Playlist playlist)
        {
            try
            {
                //init();
                // Connect to cluster
                ISession session = cluster.Connect("maltmusic");

                // get playlist id
                Guid play_id = playlist.getID();

                // First empty the playlist by ID
                //Prepare, bind and execute statement
                String todo = "delete from playlist where playlist_id = :pid";
                PreparedStatement ps = session.Prepare(todo);
                BoundStatement bs = ps.Bind(play_id);
                session.Execute(bs);

                // After emptying the playlist, delete the ID from the list
                // Prepae, bind and execute statement
                String next = "delete from list_playlist where playlist_id = :pid";
                PreparedStatement p = session.Prepare(next);
                BoundStatement b = p.Bind(play_id);
                session.Execute(b);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Deleting a plist broke " + ex);
            }
        }
        public void createTempPlaylist(Playlist p)
        {
            try
            {
                //init();
                ISession session = cluster.Connect("maltmusic");

                String plName = p.getPlaylistName();
                Guid pid = p.getID();
                String owner = p.getOwner();

                String todo = ("insert into list_playlist (\n" +
                      "playlist_id, owner,playlist_name)\n" +
                     "values (:pid,:own,:plnm) if not exists using TTL 3600");

                PreparedStatement ps = session.Prepare(todo);

                BoundStatement bs = ps.Bind(pid, owner, plName);

                session.Execute(bs);

                addToTempPlaylist(p, session);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception during playlist create" + e);
            }
        }