/// <summary> /// Saves the provided image with the specified dimensions and then adds references to the results in the persistance store. /// Then the image object is disposed, and an image entity is returned. /// </summary> public Picture Persist(Image image, PictureSize size = PictureSize.All) { throw new NotImplementedException(); Ensure.That(() => image).IsNotNull(); if (size == PictureSize.None) { return null; } Picture picture = null; // pictureRepository.Create(); string filename = fsHelper.GenerateRandomFilenameFormat(); using (image) { foreach (KeyValuePair<PictureSize, Action<Picture, string>> option in GetResizeOptions()) { if (size.HasFlag(option.Key)) { int max = option.Key.GetAttribute<PicturePixelsAttribute>().Pixels; option.Value(picture, SizeAndSaveImage(filename, image, max)); } } return picture; } }