private static ItemIdentifier GetTargetPath(ICollection<ItemIdentifier> mergesRelationships, ItemIdentifier targetBranch)
{
if (mergesRelationships == null || mergesRelationships.Count == 0)
return null;
var targetItem = mergesRelationships.FirstOrDefault(m => IsTargetPath(m, targetBranch));
if (targetItem != null)
{
mergesRelationships.Remove(targetItem);
return targetItem;
}
return null;
}