private bool WorkitemHasOpenDuplicate(WorkitemEntity item)
        {
            var filter    = Filter.Equal(configuration.ExternalIdFieldName, item.GetProperty <string>(configuration.ExternalIdFieldName));
            var workitems = v1Processor.GetWorkitems(item.TypeName, filter);

            return(workitems.Any(workitem => !workitem.IsClosed));
        }
        public IList <ServerConnector.Entities.Workitem> GetDuplicates(Workitem item)
        {
            var emptyDuplicateList = new List <ServerConnector.Entities.Workitem>();

            if (string.IsNullOrEmpty(item.ExternalSystemName) || string.IsNullOrEmpty(configuration.ExternalIdFieldName))
            {
                return(emptyDuplicateList);
            }

            try {
                var filter = GroupFilter.And(
                    Filter.Equal(Entity.SourceNameProperty, item.ExternalSystemName),
                    Filter.Equal(configuration.ExternalIdFieldName, item.ExternalId),
                    Filter.OfTypes(VersionOneProcessor.PrimaryWorkitemType)
                    );

                var duplicates = v1Processor.GetWorkitems(item.Type, filter);
                return(duplicates);
            } catch (VersionOneException ex) {
                logger.Log(LogMessage.SeverityType.Error, string.Format("Can't get duplicates for {0} {1}. Cause:\n{2}", item.Number, item.Type, ex.Message));
            }

            return(emptyDuplicateList);
        }