     
     private func asyncCleanResources()
     {
-        for reference:MPicturesItemReference in references
-        {
-            let pictureId:PictureId = reference.pictureId
-            let item:MPicturesItem? = items[pictureId]
-            item?.cleanResources()
+        let allPhotos:[PhotoId] = Array(photos.keys)
+        
+        for photoId:PhotoId in allPhotos
+        {
+            let photo:MPhotosItemPhoto? = photos[photoId]
+            photo?.resources.cleanResources()
         }
     }
     

            
            let photoStatus:MPhotos.Status = firebasePhoto.status
            let photoCreated:TimeInterval = firebasePhoto.created
            let albumId:AlbumId = firebasePhoto.album
            
            if photoStatus == Status.synced
            {
                
                if let loadedItem:MPhotosItemPhoto = self.photos[photoId]
                {
                    items[photoId] = loadedItem

                    photoId:photoId,
                    created:photoCreated)
                
                album?.references.append(photoReference)
            }
            else
            {
