public void Execute(IServiceProvider serviceProvider)
        {
            //Extract the tracing service for use in debugging sandboxed plug-ins.
            ITracingService tracingService =
                (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            FaultException ex1 = new FaultException();
            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)
                                              serviceProvider.GetService(typeof(IPluginExecutionContext));

            try
            {
                IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);
                EntityCollection            targets        = (EntityCollection)context.OutputParameters["BusinessEntityCollection"];

                var lang = new UserLocaleHelper(service, context).getUserLanguage();
                foreach (Entity e in targets.Entities)
                {
                    //query the entity get columns
                    Entity record = service.Retrieve(e.LogicalName, e.Id, new ColumnSet("address1_line1"));
                    if (lang == 1033)
                    {
                        if (record.Attributes.Contains("address1_line1"))
                        {
                            e["name"] = record.GetAttributeValue <string>("address1_line1");
                        }
                    }
                    else
                    {
                        e["name"] = "French";
                    }
                }
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                throw new InvalidPluginExecutionException("An error occurred in the multi lingual plug-in.", ex);
            }
        }
        public void Execute(IServiceProvider serviceProvider)
        {
            //Extract the tracing service for use in debugging sandboxed plug-ins.
            ITracingService tracingService =
                (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            FaultException ex1 = new FaultException();
            // Obtain the execution context from the service provider.
            IPluginExecutionContext context = (IPluginExecutionContext)
                serviceProvider.GetService(typeof(IPluginExecutionContext));
            try
            {
                IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
                EntityCollection targets = (EntityCollection)context.OutputParameters["BusinessEntityCollection"];

                var lang = new UserLocaleHelper(service, context).getUserLanguage();
                foreach (Entity e in targets.Entities)
                {
                    //query the entity get columns
                    Entity record = service.Retrieve(e.LogicalName, e.Id, new ColumnSet("address1_line1"));
                    if (lang == 1033)
                    {
                        if (record.Attributes.Contains("address1_line1"))
                        {
                            e["name"] = record.GetAttributeValue<string>("address1_line1");
                        }
                    }
                    else
                    {
                        e["name"] = "French";
                    }
                }

            }
            catch (FaultException<OrganizationServiceFault> ex)
            {
                throw new InvalidPluginExecutionException("An error occurred in the multi lingual plug-in.", ex);
            }
        }