/// <summary>
        /// Deliver to email.
        /// </summary>
        private PluginExecutionResult DeliverToEmail()
        {
            PluginExecutionResult result = new PluginExecutionResult(PluginResult.Passed);

            ClearForm();
            UpdateStatus("Deliver to Email");

            int count  = _activityData.SendToEmail.NumberOfRandomRecipients;
            var toList = ExecutionServices.SessionRuntime.AsInternal().GetOfficeWorkerEmailAddresses(count);

            _runtimeRecipients = new Collection <string>(toList.Select(n => n.Address).ToList());
            _runtimeOriginator = _activityData.SendToEmail.Originator;

            SetRuntimeData();
            PopulateExecutionControls();

            // Deliver to HPCR Proxy
            foreach (var doc in _runtimeDocumentPaths)
            {
                foreach (var recipient in _runtimeRecipients)
                {
                    // Lock the document pool so that we don't get conflicts with other users.
                    ExecutionServices.CriticalSection.Run(new LocalLockToken("LocalDocument", new TimeSpan(0, 5, 0), new TimeSpan(0, 5, 0)), () =>
                    {
                        ProxyClient.DeliverToEmailByDocument(_pluginExecutionData.Servers.First().Address, doc, _runtimeOriginator, recipient);
                    });
                }
            }

            return(result);
        }