/// <summary>
        /// Setups the azure topic provider.
        /// </summary>
        /// <param name="domainManager">The domain manager.</param>
        static void SetupAzureTopicProvider(DomainManager domainManager)
        {
            if (domainManager != null && domainManager.DomainConfiguration != null)
            {
                foreach (Type data in domainManager.DomainConfiguration)
                {
                    ServiceBusDetails serviceBusDetails = GetServiceBusDetailsFromT(data);
                    if (!string.IsNullOrEmpty(serviceBusDetails.Connection))
                    {
                        if (!string.IsNullOrWhiteSpace(serviceBusDetails.TopicName))
                        {
                            ////Add topic client to _topicManager which will be used for publish
                            string topicKeyName = $"{serviceBusDetails.Endpoint}||{serviceBusDetails.TopicName}";
                            if (!_topicManager.ContainsKey(topicKeyName))
                            {
                                ////Check for topic and if not exists AzureTopicProvider will create it.
                                AzureTopicProvider azureTopicProvider = new AzureTopicProvider(serviceBusDetails.Connection, serviceBusDetails.TopicName, serviceBusDetails.Subscription);
                                azureTopicProvider.AddTopic();

                                AzureTopicPublisher topicClient = new AzureTopicPublisher(serviceBusDetails.Connection, serviceBusDetails.TopicName);
                                _topicManager.TryAdd(topicKeyName, topicClient);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Subscribes the specified target model.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="targetModel">The target model.</param>
        /// <param name="handler">The handler.</param>
        /// <returns></returns>
        public bool Subscribe <T>(T targetModel, Func <T, Task> handler)
        {
            try
            {
                ServiceBusDetails serviceBusDetails = GetServiceBusDetailsFromT(targetModel.GetType());

                if (!string.IsNullOrEmpty(serviceBusDetails.Connection))
                {
                    //Check for Subscription and topic, if not exists AzureTopicProvider will create both them.
                    //we are considering UserProperty event id for sql filter
                    AzureTopicProvider azureTopicProvider = new AzureTopicProvider(serviceBusDetails.Connection, serviceBusDetails.TopicName, serviceBusDetails.Subscription);

                    //// version wise event bus: Each version wise subscriber get only message of that versioned model/object
                    string routingKey = $"user.eId = {serviceBusDetails.EventId}  AND user.ver = {serviceBusDetails.EventTypeVersion}";

                    azureTopicProvider.AddSubscriber(routingKey);

                    subscriptionClient = new AzureTopicSubscriber(serviceBusDetails.Connection, serviceBusDetails.TopicName, serviceBusDetails.Subscription);
                    MessageHandlerOptions messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler)
                    {
                        MaxConcurrentCalls = 1,
                        AutoComplete       = true
                    };

                    //subscriptionClient.RegisterMessageHandler(handler, messageHandlerOptions);
                    subscriptionClient.RegisterMessageHandler(async(msg, token) =>
                    {
                        try
                        {
                            // Get message
                            string message = Encoding.UTF8.GetString(msg.Body).ToBase64Decode();

                            EventModel <object> objEvent1 = JsonConvert.DeserializeObject <EventModel <object> >(message);
                            T retrunModel = JsonConvert.DeserializeObject <T>(JsonConvert.SerializeObject(objEvent1.OriginalValue));

                            msg.UserProperties.Add(new KeyValuePair <string, object>("tsReceive", DateTime.UtcNow.Ticks));
                            msg.UserProperties.Add(new KeyValuePair <string, object>("rId", _domainManager.ServiceType));

                            PropertyInfo prop = null;

                            //// set producer id to the message model which will be received by subscriber
                            if (msg.UserProperties.TryGetValue("pId", out object producerId))
                            {
                                prop = retrunModel.GetType().GetProperty("_ProducerId", BindingFlags.Public | BindingFlags.Instance);
                                if (null != prop && prop.CanWrite)
                                {
                                    prop.SetValue(retrunModel, producerId, null);
                                }
                            }

                            //// set original message to the message model which will be received by subscriber
                            prop = retrunModel.GetType().GetProperty("_OriginalMessage", BindingFlags.Public | BindingFlags.Instance);
                            if (null != prop && prop.CanWrite)
                            {
                                prop.SetValue(retrunModel, JsonConvert.SerializeObject(msg), null);
                            }

                            //// set producer application id to the message model which will be received by subscriber
                            if (msg.UserProperties.TryGetValue("paId", out object producerApplicationId))
                            {
                                prop = retrunModel.GetType().GetProperty("_ProducerApplicationId", BindingFlags.Public | BindingFlags.Instance);
                                if (null != prop && prop.CanWrite)
                                {
                                    prop.SetValue(retrunModel, producerApplicationId, null);
                                }
                            }

                            //// set event id to the message model which will be received by subscriber
                            if (msg.UserProperties.TryGetValue("eId", out object eventId))
                            {
                                prop = retrunModel.GetType().GetProperty("_EventId", BindingFlags.Public | BindingFlags.Instance);
                                if (null != prop && prop.CanWrite)
                                {
                                    prop.SetValue(retrunModel, eventId, null);
                                }
                            }

                            handler(retrunModel);
                        }
                        catch (Exception ex)
                        {
                        }
                    }, messageHandlerOptions);

                    return(true);
                }

                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }