public SourceMarket GetBy(string code)
        {
            if (string.IsNullOrWhiteSpace(code))
            {
                return(null);
            }
            SourceMarket sm = null;

            if (Items.TryGetValue(code, out sm))
            {
                return(sm);
            }
            return(null);
        }
        protected override void Execute(CodeActivityContext executionContext)
        {
            ITracingService             trace          = executionContext.GetExtension <ITracingService>();
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                var sourceMarketId          = SourceMarket.Get <EntityReference>(executionContext);
                var teamDefaultQueueService = new GetTeamDefaultQueueService();
                trace.Trace("getting team default queue by Source Market.");

                var response = teamDefaultQueueService.GetTeamDefaultQueue(sourceMarketId, service, trace);
                if (response != null)
                {
                    executionContext.SetValue <EntityReference>(Queue, response);
                }
                else
                {
                    trace.Trace("response is null");
                }
                return;
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                throw new InvalidPluginExecutionException(ex.ToString());
            }
            catch (TimeoutException ex)
            {
                throw new InvalidPluginExecutionException(ex.ToString());
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(ex.ToString());
            }
        }