/// <summary>
        /// Receives search criteria parameters (key/value pair) and returns a list of matching Subscribers
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Dtos.GetQuotesResults SendQuote(Dtos.GetQuotesInput input)
        {
            Dtos.GetQuotesResults returnResults = new Dtos.GetQuotesResults();
            
            try
            {
                Logger.ErrorFormat("CH000:START");
                //Get get Subscriber details
                var subscriber = _subscriberRepository.Get(input.SubscriberRefId);

                //Get the Request details
                var request = _requestRepository.Get(input.RequestRefId);

                //Save Quote
                var quote = new Quote
                {
                    Cost = input.Cost,
                    Message = input.Message,
                    RequestRefId = request.Id,
                    SubscriberRefId = subscriber.Id
                };
                Logger.ErrorFormat("CH000:START2");
                //Saving entity with standard Insert method of repositories.
                int quotesId = _quoteRepository.InsertAndGetId(quote);

                //Update Subscriber Credits
                var subscriberCredits = new SubscriberCredits()
                {
                    SubscriberRefId = input.SubscriberRefId,
                    Credits = input.TotalCredits * -1
                };
                Logger.ErrorFormat("CH000:START3");
                int subscriberCreditsResponse = _subscriberCreditsRepository.InsertAndGetId(subscriberCredits);

                //Get Company Configuration
                Logger.ErrorFormat("CH000:START4");
                var companyConfig = _companyConfigRepository.GetCompanyConfigurations(input.CompanyId);
                string emailFrom = companyConfig.Find(cc => cc.Name.Equals(System.Configuration.ConfigurationSettings.AppSettings["creditsHero:EmailReply"])).Value != null 
                    ? companyConfig.Find(cc => cc.Name.Equals(System.Configuration.ConfigurationSettings.AppSettings["creditsHero:EmailReply"])).Value 
                    : "*****@*****.**";
                string emailSubject = companyConfig.Find(cc => cc.Name.Equals(System.Configuration.ConfigurationSettings.AppSettings["creditsHero:EmailSubject"])).Value != null 
                    ? companyConfig.Find(cc => cc.Name.Equals(System.Configuration.ConfigurationSettings.AppSettings["creditsHero:EmailSubject"])).Value
                    : "Vendor Quote";

                Logger.ErrorFormat("CH000:START5");
                //Send text message (This is a quote message FROM subscriber TO customer)
                Logger.ErrorFormat("CH000:START5j-_notificationRepoIsNull{0}, _companyConfigRep{0}", (_notificationRepository== null).ToString(), (_companyConfigRepository== null).ToString());
                NotificationAppService notificationService = new NotificationAppService(_notificationRepository, _companyConfigRepository);
                Logger.ErrorFormat("CH000:START5d");
                Logger.ErrorFormat("CH000:START5d-SubscriberID{0}, RequestID{1}", subscriber.Id.ToString(), request.Id.ToString());
                Messaging.Dtos.NotificationInput notificationInput = new Dtos.NotificationInput();
                Logger.ErrorFormat("CH000:START5e");
                notificationInput.CompanyId = input.CompanyId;
                Logger.ErrorFormat("CH000:START5f");
                notificationInput.EmailFrom = emailFrom;
                Logger.ErrorFormat("CH000:START5g");
                notificationInput.EmailSubject = emailSubject;
                Logger.ErrorFormat("CH000:START5h");
                notificationInput.EmailMessage = String.Format("Hello {0}: {1} has submitted a quote.  Click here to view the quote.", request.FullName, subscriber.FullName);
                Logger.ErrorFormat("CH000:START5i");
                notificationInput.EmailTo = request.SmsNumber;
                Logger.ErrorFormat("CH000:START5j");
                Logger.ErrorFormat("CH000:START5j-notificationServiceIsNull{0}", (notificationService == null).ToString());
                notificationService.SendNotification(notificationInput);
                Logger.ErrorFormat("CH000:START5k");

                Logger.ErrorFormat("CH000:START6");
                //Send send email message (This is a email message FROM Subscriber TO customer)
                //NotificationAppService notificationService = new NotificationAppService(_notificationRepository);
                notificationService.SendEmailNotification(new Messaging.Dtos.NotificationInput()
                {
                    CompanyId = input.CompanyId,
                    EmailFrom = emailFrom,
                    EmailSubject = emailSubject,
                    EmailMessage = String.Format("Hello {0}: {1} has submitted a quote.  Click here to view the quote.", request.FullName, subscriber.FullName),
                    EmailTo = request.Email
                });

                Logger.ErrorFormat("CH000:START7");
                returnResults = new Dtos.GetQuotesResults()
                {
                    QuoteId = quotesId,
                    ResponseMessage = "Quote successfully sent."
                };
                
                return returnResults;
            }
            catch (System.Exception exc)
            {
                Logger.ErrorFormat("CH000:STARTZ{0}EXCSOURCE={1}EXCDATA={2}EXCINNEREXCEPTION{3}", exc.Message, exc.Source, exc.Data, exc.InnerException.Message);
                returnResults.ResponseMessage = exc.InnerException.Message;
                return returnResults;
            }
        }
        public SubscribersCreditDto AddSubscriberCredits(CreateSubscribersCreditsInput input)
        {
            var subscriberCredits = new SubscriberCredits()
            {
                SubscriberRefId = input.SubscribersId,
                Credits = input.Credits
            };

            //Saving entity with standard Insert method of repositories.
            int SubscribersValueId = _subscriberCreditsRepository.InsertAndGetId(subscriberCredits);

            return new SubscribersCreditDto
            {
                Credits = input.Credits,
                SubscriberId = input.SubscribersId
            };
        }