//Use the Composite Pattern.

//Initialize album collection
List<IComponent> albums = new List<IComponent>();

//Create first album and add it to the albums collection
Album firstAlbum = new Album("First Album");
albums.Add(firstAlbum);

//Create second album and add it to the albums collection
Album secondAlbum = new Album("Second Album");
albums.Add(secondAlbum);

//Create third album and add it to the albums collection
Album thirdAlbum = new Album("Third Album");
albums.Add(thirdAlbum);

//Add 3 photos in the first album
firstAlbum.Add(new Photo("111"));
firstAlbum.Add(new Photo("222"));
firstAlbum.Add(new Photo("333"));

//Add 3 photos in the second album
secondAlbum.Add(new Photo("444"));
secondAlbum.Add(new Photo("555"));
secondAlbum.Add(new Photo("666"));

//Add 3 photos in the third album
thirdAlbum.Add(new Photo("777"));
thirdAlbum.Add(new Photo("888"));
thirdAlbum.Add(new Photo("999"));

//Display photos in the first album
Console.WriteLine("Photos in First Album:");
Console.WriteLine(firstAlbum.Display());

//Add another photo in the first album
Photo anotherPhoto = new Photo("444"));
firstAlbum.Add(anotherPhoto);

//Display photos in the first album after adding new photo
Console.WriteLine("Photos in First Album after adding new photo:");
Console.WriteLine(firstAlbum.Display());

//Remove second photo in the first album
Photo secondPhoto = (Photo)firstAlbum.Photos[1];
firstAlbum.Remove(secondPhoto);

//Display photos in the first album after removing the second photo
Console.WriteLine("Photos in First Album after removing the second photo:");
Console.WriteLine(firstAlbum.Display());

//Display all albums
Console.WriteLine("Show all albums:");
foreach (IComponent item in albums)
{
Album album = (Album)item;
Console.WriteLine(album.Name);
}
Console.WriteLine();

//Search for album
Console.WriteLine("Searching for album named 'Second Album'");
Album albumFound = (Album)albums.Find(album => (album.Name == "Second Album"));

if (albumFound != null)
{
Console.WriteLine("Album found !");
Console.WriteLine("Album name: {0}", albumFound.Name);
Console.WriteLine("Album photos:");
Console.WriteLine(albumFound.Display());
}