private static void MapMediaFileProperties(MediaFile mediaFile, IPublishedContent mediaModel, string rootUrl)
        {
            mediaFile.Id   = mediaModel.Id;
            mediaFile.Name = mediaModel.Name;
            mediaFile.Url  = mediaModel.Url;
            mediaFile.DocumentTypeAlias = mediaModel.DocumentTypeAlias;
            mediaFile.DomainWithUrl     = rootUrl + mediaModel.Url;

            mediaFile.Size          = mediaModel.GetPropertyValue <int>("umbracoBytes");
            mediaFile.FileExtension = mediaModel.GetPropertyValue <string>("umbracoExtension");
        }
        public static object GetMediaFile(IUmbracoMapper mapper, IPublishedContent contentToMapFrom, string propertyName, bool recursive)
        {
            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
            var mediaModel    = umbracoHelper.TypedMedia(contentToMapFrom.GetPropertyValue <int>(propertyName));

            if (mediaModel == null)
            {
                return(null);
            }

            var mediaFile = new MediaFile();

            MapMediaFileProperties(mediaFile, mediaModel, mapper.AssetsRootUrl);

            return(mediaFile);
        }