public void UpdateWebResources(UpdateResourcesSettings us)
        {
            if (us.AddToSolution)
            {
                var sPicker = new SolutionPicker(Service, true)
                {
                    StartPosition = FormStartPosition.CenterParent
                };

                if (sPicker.ShowDialog(this) == DialogResult.OK)
                {
                    us.SolutionUniqueName = sPicker.SelectedSolution["uniquename"].ToString();
                }
                else
                {
                    return;
                }
            }

            // TODO Disable controls during update

            tv.Service = Service;

            WorkAsync(new WorkAsyncInfo
            {
                Message       = "Updating web resources...",
                AsyncArgument = us,
                Work          = (bw, e) =>
                {
                    var settings         = (UpdateResourcesSettings)e.Argument;
                    var resourcesUpdated = new List <Webresource>();
                    var resources        = new List <Webresource>();

                    // Add Regular Resources, and Associated Web Resources
                    foreach (var resource in settings.Webresources)
                    {
                        resources.Add(resource);
                        if (resource.AssociatedResources != null)
                        {
                            resources.AddRange(resource.AssociatedResources);
                        }
                    }

                    foreach (var resource in resources)
                    {
                        try
                        {
                            bw.ReportProgress(1, $"Updating {resource}...");
                            resource.Update(Service, us.Overwrite);

                            resourcesUpdated.Add(resource);
                            resource.LastException = null;
                        }
                        catch (Exception error)
                        {
                            resource.LastException = error;
                        }
                    }

                    // Process post Update command
                    if (!string.IsNullOrEmpty(Settings.Instance.AfterUpdateCommand))
                    {
                        foreach (var webResource in resourcesUpdated)
                        {
                            EventManager.ActAfterUpdate(webResource, Settings.Instance);
                        }
                    }

                    // if publish
                    if (settings.Publish && resourcesUpdated.Count > 0)
                    {
                        bw.ReportProgress(2, "Publishing web resources...");

                        Webresource.Publish(resourcesUpdated, Service);
                    }

                    // Process post Publish command
                    if (!string.IsNullOrEmpty(Settings.Instance.AfterPublishCommand))
                    {
                        foreach (var webResource in resourcesUpdated)
                        {
                            EventManager.ActAfterPublish(webResource, Settings.Instance);
                        }
                    }

                    if (settings.AddToSolution && !string.IsNullOrEmpty(settings.SolutionUniqueName) && resourcesUpdated.Count > 0)
                    {
                        bw.ReportProgress(3, "Adding web resources to solution...");
                        Webresource.AddToSolution(resourcesUpdated, settings.SolutionUniqueName, Service);
                    }

                    e.Result = new UpdateResourcesResult
                    {
                        FaultedResources   = resources.Except(resourcesUpdated),
                        Publish            = settings.Publish,
                        AddToSolution      = settings.AddToSolution,
                        SolutionUniqueName = settings.SolutionUniqueName
                    };
                },
                ProgressChanged  = e => { SetWorkingMessage(e.UserState.ToString()); },
                PostWorkCallBack = e =>
                {
                    if (e.Error != null)
                    {
                        MessageBox.Show(this, e.Error.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    var result = (UpdateResourcesResult)e.Result;

                    // Identifies resources with concurrency behavior error
                    //var unsyncResources = result.FaultedResources.Where(r =>
                    //    r.LastException is FaultException<OrganizationServiceFault>
                    //    && ((FaultException<OrganizationServiceFault>)r.LastException).Detail.ErrorCode ==
                    //    -2147088254).ToList();
                    var unsyncResources =
                        result.FaultedResources.Where(r => r.LastException is MoreRecentRecordExistsException).ToList();
                    var otherResources = result.FaultedResources.Except(unsyncResources).ToList();

                    if (unsyncResources.Any() || otherResources.Any())
                    {
                        var dialog = new ConcurrencySummaryDialog(unsyncResources, otherResources);
                        if (dialog.ShowDialog(this) == DialogResult.Retry)
                        {
                            var retryUs = new UpdateResourcesSettings
                            {
                                Webresources       = unsyncResources,
                                Publish            = result.Publish,
                                AddToSolution      = result.AddToSolution,
                                SolutionUniqueName = result.SolutionUniqueName,
                                Overwrite          = true
                            };

                            UpdateWebResources(retryUs);
                        }
                    }
                }
            });
        }