public static EntityReference GetTargetEntityReference(this IPluginContext pluginContext) { ValidationHelper.EnsureNotNull(pluginContext); if (pluginContext.GetTargetEntityType() == TargetType.EntityReference) { return((EntityReference)pluginContext.ExecutionContext.InputParameters["Target"]); } return(null); }