public IViewComponentResult Invoke() { var mediaLibary = mediaFileRepository.GetByName(MEDIA_LIBRARY_NAME); if (mediaLibary == null) { return(Content(string.Empty)); } var mediaFiles = mediaFileRepository.GetMediaFiles(MEDIA_LIBRARY_NAME); var mediaGallery = new MediaGalleryViewModel(mediaLibary.LibraryDisplayName); mediaGallery.MediaFiles = mediaFiles.Select(file => MediaFileViewModel.GetViewModel(file, fileUrlRetriever)); return(View("~/Components/ViewComponents/MediaGallery/Default.cshtml", mediaGallery)); }