示例#1
0
        public void PollForCallQueue()
        {
            try
            {
                _logger.Info("Starting single call queue customer for Upsell");
                var callQueue = _callQueueRepository.GetCallQueueByCategory(CallQueueCategory.Upsell);
                var criterias = _systemGeneratedCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteriaNotGenerated(callQueue.Id);
                foreach (var criteria in criterias)
                {
                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                    var callQueueCustomers = _upsellCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria.Amount, criteria.NoOfDays);
                    if (callQueueCustomers != null && callQueueCustomers.Any())
                    {
                        _logger.Info(string.Format("{0} single call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                        _logger.Info(string.Format("{0} single call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                    }
                    else
                    {
                        _logger.Info(string.Format("No single call queue customer found for {0}  for Agent Id : {1}", callQueue.Category, criteria.AssignedToOrgRoleUserId));
                    }

                    criteria.IsQueueGenerated       = true;
                    criteria.LastQueueGeneratedDate = DateTime.Now;
                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                }
                callQueue.IsQueueGenerated       = true;
                callQueue.LastQueueGeneratedDate = DateTime.Now;
                _callQueueRepository.Save(callQueue);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error while pulling single Upsell Event call queue. Message {0} \n Stack Trace {1}", ex.Message, ex.StackTrace));
            }
        }
        public void PollForCallQueue()
        {
            try
            {
                _logger.Info("Entering Single Health Plan NoShows Polling Agent");
                var callQueue = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.NoShows);
                var criterias = _healthPlanCallQueueCriteriaService.GetHealthPlanCallQueueCriteriaNotGenerated(callQueue.Id);

                var healthPlanIds = criterias.Where(x => x.HealthPlanId != null).Select(x => x.HealthPlanId.Value).ToArray();
                var healthPlans   = _corporateAccountRepository.GetByIds(healthPlanIds);

                foreach (var criteria in criterias)
                {
                    try
                    {
                        _logger.Info(string.Format("Generating single No Show call queue."));
                        _healthPlanCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);

                        if (criteria.HealthPlanId.HasValue)
                        {
                            var healthPlan = healthPlans.First(x => x.Id == criteria.HealthPlanId.Value);
                            _healthPlanCallRoundService.SaveNoShowCallQueueCustomers(healthPlan, criteria, callQueue, _logger);
                        }

                        _logger.Info(string.Format("Completed single No Show call queue."));

                        criteria.IsQueueGenerated       = true;
                        criteria.LastQueueGeneratedDate = DateTime.Now;

                        _healthPlanCallQueueCriteriaService.Save(criteria);
                    }
                    catch (Exception exception)
                    {
                        _logger.Error(string.Format("Error while generating call queue No show  customer data for Criteria Id: {0} \n message: {1} stack trace {2}", criteria.Id, exception.Message, exception.StackTrace));
                    }
                }

                callQueue.IsQueueGenerated       = true;
                callQueue.LastQueueGeneratedDate = DateTime.Now;
                _callQueueRepository.Save(callQueue);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error while pulling single call round call queue. Message {0} \n Stack Trace {1}", ex.Message, ex.StackTrace));
            }
        }
示例#3
0
        public void SendCustomersOnCallQueue()
        {
            try
            {
                var callQueues = _callQueueRepository.GetAll().Where(x => x.IsActive && (x.IsQueueGenerated == false || (DateTime.Now >= (x.LastQueueGeneratedDate.HasValue ? x.LastQueueGeneratedDate.Value.AddMinutes(x.QueueGenerationInterval.Value) : DateTime.Now))));

                foreach (CallQueue queue in callQueues)
                {
                    var callAssignMents = _callQueueAssignmentRepository.GetByCallQueueId(queue.Id);

                    _callQueueCustomerRepository.DeleteForInActiveCallQueueCriteria(queue.Id);

                    var customerList = _outboundCallQueueService.GetCallQueueCustomers(queue);

                    //int callsToInsert = customerList.Count > 1000 ? 1000 : customerList.Count;//only this number of calls to be inserted at a time
                    if (!queue.IsQueueGenerated)
                    {
                        //var shortList = customerList.Take(callsToInsert);
                        //customerList = shortList.ToList();
                        _outboundCallQueueService.ChangeAssignmentOfExistingQueue(queue, callAssignMents);
                    }
                    int totalRecords = customerList.Count;

                    //assigning each call centre user with number of customer based on percentage
                    var callDivision = (from ca in callAssignMents
                                        let count = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(totalRecords * ca.Percentage) / 100))
                                                    select new
                    {
                        AssignedTo = ca.AssignedOrgRoleUserId,
                        callCount = count > 0 ? count : 1
                    }).ToList();
                    int startCount = 0;
                    for (int i = 0; i < callDivision.Count; i++)
                    {
                        int endCount = callDivision[i].callCount;

                        int thresholdCount = customerList.Count < (startCount + endCount) ? customerList.Count : (startCount + endCount);

                        for (int j = startCount; j < thresholdCount; j++)
                        {
                            CallQueueCustomer callQueueCustomer = customerList[j];

                            if (_callQueueCustomerRepository.IsCallQueueExist(queue.Id, callQueueCustomer.ProspectCustomerId.HasValue ? callQueueCustomer.ProspectCustomerId.Value : 0, callQueueCustomer.CustomerId.HasValue ? callQueueCustomer.CustomerId.Value : 0, callQueueCustomer.EventId, _settings.NoOfDaysToIncludeRemovedFromQueue))
                            {
                                continue;
                            }

                            callQueueCustomer.CallQueueId = queue.Id;

                            callQueueCustomer.IsActive                = true;
                            callQueueCustomer.Attempts                = 0;
                            callQueueCustomer.DateCreated             = DateTime.Now;
                            callQueueCustomer.Status                  = CallQueueStatus.Initial;
                            callQueueCustomer.AssignedToOrgRoleUserId = callDivision[i].AssignedTo;
                            callQueueCustomer.CallDate                = DateTime.Now;
                            _callQueueCustomerRepository.Save(callQueueCustomer);
                        }
                        //Once the quota for 1 user is complete next user will start from that
                        startCount = startCount + endCount;
                    }

                    queue.IsQueueGenerated       = true;
                    queue.LastQueueGeneratedDate = DateTime.Now;
                    _callQueueRepository.Save(queue);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Message:{0} \nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
        }
        public void PollForHealthPlanCallQueue()
        {
            try
            {
                var callQueue = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.FillEventsHealthPlan);

                var healthPlans = _corporateAccountRepository.GetAllHealthPlan();
                _logger.Info("Started Healthfair Fill Event call Queue For Generated Call Queues For 24 hrs");

                if (callQueue != null)
                {
                    try
                    {
                        var criteria = _healthPlanCallQueueCriteria.GetQueueCriteriasByQueueId(callQueue.Id);
                        criteria = criteria.Where(x => x.IsQueueGenerated).OrderByDescending(x => x.Id);

                        foreach (var queueCriteria in criteria)
                        {
                            try
                            {
                                _healthPlanCallQueueAssignment.DeleteByCriteriaId(queueCriteria.Id);
                                _healthPlanFillEventCallQueueRepository.DeleteByCriteriaId(queueCriteria.Id);

                                //if (queueCriteria.IsDefault)
                                //{
                                //    foreach (var corporateAccount in healthPlans)
                                //    {
                                //        _healthPlanCallRoundService.SaveHealthPlanFillEventCallQueueCustomers(corporateAccount, queueCriteria, callQueue, _logger);
                                //    }
                                //}
                                //else

                                if (queueCriteria.HealthPlanId.HasValue && !healthPlans.IsNullOrEmpty())
                                {
                                    var corporateAccount = healthPlans.First(x => x.Id == queueCriteria.HealthPlanId.Value);

                                    _healthPlanCallRoundService.SaveHealthPlanFillEventCallQueueCustomers(corporateAccount, queueCriteria, callQueue, _logger);
                                }

                                queueCriteria.IsQueueGenerated       = true;
                                queueCriteria.LastQueueGeneratedDate = DateTime.Now;
                                _healthPlanCallQueueCriteria.Save(queueCriteria);
                            }
                            catch (Exception ex)
                            {
                                _logger.Error(string.Format("error health plan call queue. callQueueId: {0} CriteriaId {1} ", callQueue.Id, queueCriteria.Id));
                                _logger.Error(string.Format("Message {0} stack trace: {1} ", ex.Message, ex.StackTrace));
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        _logger.Error(string.Format("error health plan call queue. callQueueId: {0} ", callQueue.Id));
                        _logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace));
                    }
                    callQueue.IsQueueGenerated       = true;
                    callQueue.LastQueueGeneratedDate = DateTime.Now;
                    _callQueueRepository.Save(callQueue);
                }
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("error health plan call queue."));
                _logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace));
            }
        }
        public void PollForCallQueue()
        {
            try
            {
                var callQueues = _callQueueRepository.GetAll(false);
                if (callQueues != null && callQueues.Any())
                {
                    foreach (var callQueue in callQueues)
                    {
                        var criterias = _systemGeneratedCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(callQueue.Id);
                        criterias = criterias.Where(x => x.IsQueueGenerated);
                        try
                        {
                            IEnumerable <CallQueueCustomer> callQueueCustomers;
                            switch (callQueue.Category)
                            {
                            case CallQueueCategory.EasiestToConvertProspect:
                                callQueueCustomers = _easiestToConvertCallQueueService.GetCallQueueCustomers(callQueue.Id, callQueue.LastQueueGeneratedDate);
                                if (callQueueCustomers != null && callQueueCustomers.Any())
                                {
                                    _logger.Info(string.Format("{0} call queue customer found for {1}", callQueueCustomers.Count(), callQueue.Category));
                                    _callQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomers);
                                    _logger.Info(string.Format("{0} call queue customer saved for {1}", callQueueCustomers.Count(), callQueue.Category));
                                }
                                else
                                {
                                    _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                }
                                break;

                            case CallQueueCategory.Annual:
                                callQueueCustomers = _annualCallQueueService.GetCallQueueCustomers(callQueue.Id);
                                if (callQueueCustomers != null && callQueueCustomers.Any())
                                {
                                    _logger.Info(string.Format("{0} call queue customer found for {1}", callQueueCustomers.Count(), callQueue.Category));
                                    _callQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomers);
                                    _logger.Info(string.Format("{0} call queue customer saved for {1}", callQueueCustomers.Count(), callQueue.Category));
                                }
                                else
                                {
                                    _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                }
                                break;

                            case CallQueueCategory.CallBack:
                                callQueueCustomers = _callBackCallQueueService.GetCallQueueCustomers(callQueue.Id, callQueue.LastQueueGeneratedDate);
                                if (callQueueCustomers != null && callQueueCustomers.Any())
                                {
                                    _logger.Info(string.Format("{0} call queue customer found for {1}", callQueueCustomers.Count(), callQueue.Category));
                                    _callQueueCustomerHelper.SaveCallQueueCustomerForCallBack(callQueueCustomers);
                                    _logger.Info(string.Format("{0} call queue customer saved for {1}", callQueueCustomers.Count(), callQueue.Category));
                                }
                                else
                                {
                                    _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                }
                                break;

                            case CallQueueCategory.FillEvents:
                                foreach (var criteria in criterias)
                                {
                                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                                    callQueueCustomers = _fillEventsCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria);
                                    if (callQueueCustomers != null && callQueueCustomers.Any())
                                    {
                                        _logger.Info(string.Format("{0} call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                                        _logger.Info(string.Format("{0} call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                    }
                                    else
                                    {
                                        _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                    }

                                    criteria.IsQueueGenerated       = true;
                                    criteria.LastQueueGeneratedDate = DateTime.Now;
                                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                                }
                                break;

                            case CallQueueCategory.Upsell:
                                foreach (var criteria in criterias)
                                {
                                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                                    callQueueCustomers = _upsellCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria.Amount, criteria.NoOfDays);
                                    if (callQueueCustomers != null && callQueueCustomers.Any())
                                    {
                                        _logger.Info(string.Format("{0} call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                                        _logger.Info(string.Format("{0} call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                    }
                                    else
                                    {
                                        _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                    }

                                    criteria.IsQueueGenerated       = true;
                                    criteria.LastQueueGeneratedDate = DateTime.Now;
                                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                                }

                                break;

                            case CallQueueCategory.Confirmation:
                                foreach (var criteria in criterias)
                                {
                                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                                    callQueueCustomers = _confirmationCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria.NoOfDays);
                                    if (callQueueCustomers != null && callQueueCustomers.Any())
                                    {
                                        _logger.Info(string.Format("{0} call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                                        _logger.Info(string.Format("{0} call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                    }
                                    else
                                    {
                                        _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                    }

                                    criteria.IsQueueGenerated       = true;
                                    criteria.LastQueueGeneratedDate = DateTime.Now;
                                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                                }
                                break;
                            }

                            callQueue.IsQueueGenerated       = true;
                            callQueue.LastQueueGeneratedDate = DateTime.Now;
                            _callQueueRepository.Save(callQueue);
                        }
                        catch (Exception ex)
                        {
                            _logger.Error(string.Format("Error while creating {0} call queue. Message {1} \n Stack Trace {2}", callQueue.Category, ex.Message, ex.StackTrace));
                        }
                    }
                }
                else
                {
                    _logger.Info("No System generated call queue exist.");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error while pulling System generated call queue. Message {0} \n Stack Trace {1}", ex.Message, ex.StackTrace));
            }
        }
        public void PollForHealthPlanCallQueue()
        {
            try
            {
                _logger.Info("Entering Health Plan Polling Agent To Generate Call Queue For CallRound, NoShows and ZipRadius");

                var callQueues  = _callQueueRepository.GetAll(false, true);
                var healthPlans = _corporateAccountRepository.GetAllHealthPlan();

                if (!callQueues.IsNullOrEmpty())
                {
                    callQueues = callQueues.Where(x => x.Category != HealthPlanCallQueueCategory.FillEventsHealthPlan && x.Category != HealthPlanCallQueueCategory.UncontactedCustomers &&
                                                  x.Category != HealthPlanCallQueueCategory.MailRound);

                    foreach (var callQueue in callQueues)
                    {
                        try
                        {
                            var criteria = _healthPlanCallQueueCriteria.GetQueueCriteriasByQueueId(callQueue.Id);
                            criteria = criteria.Where(x => x.IsQueueGenerated);

                            switch (callQueue.Category)
                            {
                            case HealthPlanCallQueueCategory.CallRound:
                            {
                                foreach (var queueCriteria in criteria)
                                {
                                    try
                                    {
                                        _healthPlanCallQueueAssignment.DeleteByCriteriaId(queueCriteria.Id);

                                        if (queueCriteria.HealthPlanId.HasValue && !healthPlans.IsNullOrEmpty())
                                        {
                                            var corporateAccount = healthPlans.First(x => x.Id == queueCriteria.HealthPlanId.Value);
                                            _healthPlanCallRoundService.SaveCallRoundCallQueueCustomers(corporateAccount, queueCriteria, callQueue, _logger);
                                        }
                                        queueCriteria.IsQueueGenerated       = true;
                                        queueCriteria.LastQueueGeneratedDate = DateTime.Now;
                                        _healthPlanCallQueueCriteria.Save(queueCriteria);
                                    }
                                    catch (Exception exception)
                                    {
                                        _logger.Error("call Queue Id " + callQueue.Id);
                                        _logger.Error("criteria Id " + queueCriteria.Id);
                                        _logger.Error("Message " + exception.Message);
                                        _logger.Error("Stack Trace " + exception.StackTrace);
                                    }
                                }
                            }
                            break;

                                //case HealthPlanCallQueueCategory.NoShows:
                                //    {
                                //        foreach (var queueCriteria in criteria)
                                //        {
                                //            try
                                //            {
                                //                _healthPlanCallQueueAssignment.DeleteByCriteriaId(queueCriteria.Id);

                                //                if (queueCriteria.HealthPlanId.HasValue && !healthPlans.IsNullOrEmpty())
                                //                {
                                //                    var corporateAccount = healthPlans.First(x => x.Id == queueCriteria.HealthPlanId.Value);
                                //                    _healthPlanCallRoundService.SaveNoShowCallQueueCustomers(corporateAccount, queueCriteria, callQueue, _logger);
                                //                }
                                //                queueCriteria.IsQueueGenerated = true;
                                //                queueCriteria.LastQueueGeneratedDate = DateTime.Now;
                                //                _healthPlanCallQueueCriteria.Save(queueCriteria);
                                //            }
                                //            catch (Exception exception)
                                //            {
                                //                _logger.Error("call Queue Id " + callQueue.Id);
                                //                _logger.Error("criteira Id " + queueCriteria.Id);
                                //                _logger.Error("Message " + exception.Message);
                                //                _logger.Error("Stack Trace " + exception.StackTrace);
                                //            }

                                //        }
                                //    }
                                //    break;
                                //case HealthPlanCallQueueCategory.ZipRadius:
                                //    {
                                //        foreach (var queueCriteria in criteria)
                                //        {
                                //            _healthPlanCallQueueAssignment.DeleteByCriteriaId(queueCriteria.Id);

                                //            if (queueCriteria.IsDefault)
                                //            {
                                //                foreach (var corporateAccount in healthPlans)
                                //                {
                                //                    _healthPlanCallRoundService.SaveHealthPlanZipRadiusCallQueueCustomers(corporateAccount, queueCriteria, callQueue, _logger);
                                //                }
                                //            }
                                //            else if (queueCriteria.HealthPlanId.HasValue && !healthPlans.IsNullOrEmpty())
                                //            {
                                //                var corporateAccount = healthPlans.First(x => x.Id == queueCriteria.HealthPlanId.Value);
                                //                _healthPlanCallRoundService.SaveHealthPlanZipRadiusCallQueueCustomers(corporateAccount, queueCriteria, callQueue, _logger);
                                //            }
                                //            queueCriteria.IsQueueGenerated = true;
                                //            queueCriteria.LastQueueGeneratedDate = DateTime.Now;
                                //            _healthPlanCallQueueCriteria.Save(queueCriteria);
                                //        }
                                //    }
                                //    break;
                            }
                        }
                        catch (Exception exception)
                        {
                            _logger.Error(string.Format("error health plan call queue. callQueueId: {0} ", callQueue.Id));
                            _logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace));
                        }
                        callQueue.IsQueueGenerated       = true;
                        callQueue.LastQueueGeneratedDate = DateTime.Now;
                        _callQueueRepository.Save(callQueue);
                    }
                }
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("error health plan call queue."));
                _logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace));
            }
        }
示例#7
0
        public CallQueueEditModel SaveCallQueue(CallQueueEditModel callQueueEditModel, long orgRoleUserId)
        {
            var callQueue = Mapper.Map <CallQueueEditModel, CallQueue>(callQueueEditModel);

            if (callQueue.Id > 0)
            {
                var callQueueInDb = _callQueueRepository.GetById(callQueue.Id);
                callQueue.DataRecorderMetaData                      = callQueueInDb.DataRecorderMetaData;
                callQueue.LastQueueGeneratedDate                    = callQueueInDb.LastQueueGeneratedDate;
                callQueue.DataRecorderMetaData.DateModified         = DateTime.Now;
                callQueue.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(orgRoleUserId);
            }
            else
            {
                callQueue.DataRecorderMetaData = new DataRecorderMetaData(orgRoleUserId, DateTime.Now, null);
            }
            Script script = null;

            if (callQueueEditModel.ScriptId > 0)
            {
                script              = _scriptRepository.GetById(callQueueEditModel.ScriptId);
                script.ScriptText   = callQueueEditModel.ScriptText;
                script.DateModified = DateTime.Now;
            }
            else
            {
                script = new Script
                {
                    Name         = callQueueEditModel.Name,
                    ScriptText   = callQueueEditModel.ScriptText,
                    Description  = "",
                    DateCreated  = DateTime.Now,
                    DateModified = DateTime.Now,
                    ScriptTypeId = (long)ScriptType.OutboundCallQueueScript
                };
            }

            script             = _scriptRepository.Save(script);
            callQueue.ScriptId = script.Id;

            callQueue = _callQueueRepository.Save(callQueue);


            foreach (var criteriaEditModel in callQueueEditModel.Criterias)
            {
                criteriaEditModel.CallQueueId = callQueue.Id;
            }
            var criterias = Mapper.Map <IEnumerable <CallQueueCriteriaEditModel>, IEnumerable <CallQueueCriteria> >(callQueueEditModel.Criterias);

            _callQueueCriteriaRepository.Save(criterias, callQueue.Id);

            foreach (var callQueueAssignmentEditModel in callQueueEditModel.Assignments)
            {
                callQueueAssignmentEditModel.CallQueueId = callQueue.Id;
            }
            var assignments = Mapper.Map <IEnumerable <CallQueueAssignmentEditModel>, IEnumerable <CallQueueAssignment> >(callQueueEditModel.Assignments);

            _callQueueAssignmentRepository.Save(assignments, callQueue.Id);

            callQueueEditModel.Id       = callQueue.Id;
            callQueueEditModel.ScriptId = script.Id;

            return(callQueueEditModel);
        }