/// <summary>
        /// Refreshes the ip dataset status.
        /// </summary>
        /// <param name="item">The item.</param>
        private void RefreshIPDatasetStatus(Dataset item)
        {
            if (item == null ||
                item.DRGMDCMappingStatus.In(new DrgMdcMappingStatusEnum[] { DrgMdcMappingStatusEnum.Completed, DrgMdcMappingStatusEnum.Error }))
            {
                return;
            }

            _ipDatasetRefreshPoller = new EntityPoller <Dataset>(o => o.Id == item.Id)
            {
                ActiveCycle          = 200,   //milliseconds
                IdleCycle            = 30000, //30 seconds
                RetryAttempts        = 5,
                RetryInitialInterval = 20000  //20 seconds
            };

            _ipDatasetRefreshPoller.EntityReceived += entity =>
            {
                using (var session = this.SessionProvider.SessionFactory.OpenSession())
                    session.Refresh(entity);
            };

            _ipDatasetRefreshPoller.Error += exception => Events.GetEvent <ErrorNotificationEvent>().Publish(exception);
            _ipDatasetRefreshPoller.Start();
        }
        /// <summary>
        /// Polls the entity status.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="reset">if set to <c>true</c> [reset].</param>
        /// <param name="terminate">if set to <c>true</c> [terminate].</param>
        private void PollEntityStatus(Dataset item, bool reset, bool terminate = false)
        {
            EntityPoller <Dataset> poller = null;

            if (reset)
            {
                poller = new EntityPoller <Dataset>(o => o.Id == item.Id)
                {
                    ActiveCycle          = 200,   //milliseconds
                    IdleCycle            = 30000, //30 seconds
                    RetryAttempts        = 5,
                    RetryInitialInterval = 20000  //20 seconds
                };

                poller.EntityReceived += entity =>
                {
                    var datasetType = DataTypesList.OfType <DataTypeModel>().FirstOrDefault(
                        e => e.DataTypeName.ToLower() == item.ContentType.Name.ToLower());

                    if (datasetType != null && datasetType.RecordsList.Any(dr => dr.Entry.Id == entity.Id))
                    {
                        var dsItem = datasetType.RecordsList.FirstOrDefault(dr => dr.Entry.Id == entity.Id);

                        if (dsItem != null)
                        {
                            dsItem.Entry = entity;
                        }
                    }
                };
                poller.Error += exception => Events.GetEvent <ErrorNotificationEvent>().Publish(exception);
                poller.Start();
            }

            if (terminate && poller != null)
            {
                poller.Stop();
            }
        }