private static ImageSliceContext TryCalculateSliceSize(ImageSliceContext context)
 {
     return ImageSliceContext.Create(
         context.OriginalFile,
         context.Image,
         context.Image.Select(SliceCalculator.TryCalculateSliceDimensions)
     );
 }
 private static Maybe<ImageJob> Convert(ImageSliceContext context)
 {
     return from path in context.OriginalFile
            from sliceImagePath in context.SlicedImageFile
            select new ImageJob
            {
                OriginalFilePath = path,
                SliceImagePath = sliceImagePath,
            };
 }
 private static ImageSliceContext DisposeOfImageResources(ImageSliceContext context)
 {
     using (context)
     {
         return ImageSliceContext.Create(
             context.OriginalFile,
             Maybe<Image>.Nothing,
             context.SliceSize,
             Maybe<Image>.Nothing,
             context.SlicedImageFile
         );
     }
 }
        private static ImageSliceContext TryWriteSliceImage(ImageSliceContext context)
        {
            var finalSliceImagePath = from sliceImage in context.SlicedImage
                                      from originalImagePath in context.OriginalFile
                                      from sliceImagePath in TryGetSlicedImagePath(originalImagePath)
                                      select TryWriteSliceImage(sliceImage, sliceImagePath);

            return ImageSliceContext.Create(
                context.OriginalFile,
                context.Image,
                context.SliceSize,
                context.SlicedImage,
                finalSliceImagePath
            );
        }
        private static ImageSliceContext TrySliceImage(ImageSliceContext context)
        {
            Maybe<Image> slicedImage = from originalFile in context.OriginalFile
                                       from image in context.Image
                                       from sliceSize in context.SliceSize
                                       select ImageTransformations.TryCropImage(image, sliceSize.Point, sliceSize.Size);

            return ImageSliceContext.Create(
                context.OriginalFile,
                context.Image,
                context.SliceSize,
                slicedImage
            );
        }
 private static ImageSliceContext TryLoadImage(ImageSliceContext context)
 {
     return ImageSliceContext.Create(
         context.OriginalFile,
         context.OriginalFile.Select(CommonFunctions.TryLoadImage)
     );
 }