private int GetSequenceNumberForPriority(int priority, int currentSequenceNumber) { if (priority < 0) { throw new ArgumentOutOfRangeException("priority"); } List <TransportRule> list = (from r in this.rules where r.Priority != currentSequenceNumber select r).ToList <TransportRule>(); if (priority > list.Count) { priority = list.Count; } ADRuleStorageManager.NormalizeInternalSequenceNumbersIfNecessary(list, this.session); return(ADRuleStorageManager.AssignInternalSequenceNumber(list, priority)); }