protected static T GetImage <T>(LocalPluginContext context, ImageType imageType, string name) where T : Entity
        {
            EntityImageCollection collection = null;

            if (imageType == ImageType.PreImage)
            {
                collection = context.PluginExecutionContext.PreEntityImages;
            }
            else if (imageType == ImageType.PostImage)
            {
                collection = context.PluginExecutionContext.PostEntityImages;
            }

            Entity entity;

            if (collection != null && collection.TryGetValue(name, out entity))
            {
                return(entity.ToEntity <T>());
            }
            else
            {
                return(null);
            }
        }
 protected static T GetPostImage <T>(LocalPluginContext context, string name = "PostImage") where T : Entity
 {
     return(GetImage <T>(context, ImageType.PostImage, name));
 }
 protected static T GetImage <T>(LocalPluginContext context, ImageType imageType) where T : Entity
 {
     return(GetImage <T>(context, imageType, imageType.ToString()));
 }