# Delete image libraries

This topic explains how to delete albums. The examples below show you how to delete all of the available albums or how to delete only a specific album by its *ID*.

## Deleting a single album

When deleting a specific album by its *ID*, you must perform the following:

1. *Get the album.*

   First, get an instance of the album that corresponds to the specified ID.
2. *Delete the album.*

   Mark the album to be deleted and save the changes.

The following code deletes an album by its *ID*.

**Native API**

```C#
using System;
using System.Linq;
using Telerik.Sitefinity.Libraries.Model;
using Telerik.Sitefinity.Modules.Libraries;

namespace SitefinityWebApp
{
    public class DeleteImageLibraries_DeleteAlbumNativeAPI
    {
        private void DeleteAlbumNativeAPI(Guid albumId)
        {
            LibrariesManager manager = LibrariesManager.GetManager();

            Album album = manager.GetAlbums().Where(b => b.Id == albumId).SingleOrDefault();

            if (album != null)
            {
                //Mark the album to be deleted.
                manager.DeleteAlbum(album);

                //Save the changes.
                manager.SaveChanges();
            }
        }
    }
}
```

First, you get an instance of the *LibrariesManager* class. Then, you get the album with the specified *ID*. To mark the album to be deleted, you call the DeleteAlbum method of the manager with the instance of the album as an argument. Finally, you save the changes.

**Fluent API**

```C#
using System;
using Telerik.Sitefinity;

namespace SitefinityWebApp
{
    public class DeleteImageLibraries_DeleteAlbumFluentAPI
    {
        private void DeleteAlbumFluentAPI(Guid albumId)
        {
            App.WorkWith().Album(albumId).Delete().SaveChanges();
        }
    }
}
```

First, you get the singular facade of the album with the specified *ID*. To mark the album to be deleted, you call the Delete method of the facade. Finally, you call SaveChanges.

## Deleting all albums

When deleting all albums, you must perform the following:

1. *Get all albums.*

   Get instances of the available albums.
2. *Delete each album in the collection.*

   Iterate through the collection and delete each album.

The following code deletes all albums.

**Native API**

```C#
using System.Linq;
using Telerik.Sitefinity.Libraries.Model;
using Telerik.Sitefinity.Modules.Libraries;

namespace SitefinityWebApp
{
    public class DeleteImageLibraries_DeleteAllAlbumsNativeAPI
    {
        private void DeleteAllAlbumsNativeAPI()
        {
            LibrariesManager manager = LibrariesManager.GetManager();

            var albums = manager.GetAlbums().ToList();

            foreach (Album album in albums)
            {
                manager.DeleteAlbum(album);
            }

            manager.SaveChanges();
        }
    }
}
```

First, you get an instance of the *LibrariesManager* class. Then, you get all of the available albums. You iterate through the collection and mark each album to be deleted. Finally, you save the changes.

**Fluent API**

```C#
using Telerik.Sitefinity;

namespace SitefinityWebApp
{
    public class DeleteImageLibraries_DeleteAllAlbumsFluentAPI
    {

        private void DeleteAllAlbumsFluentAPI()
        {
            App.WorkWith().Albums().Delete().SaveChanges();
        }
    }
}
```

First, you get the plural albums facade. To mark each album to be deleted, you call the Delete method of the facade. Finally, you save the changes.
