Infinite Recursion fix

If there is a loop in the resource dependencies (a resource depends on another resource that depends on it) a maximum recursion error occurs as reported in issue #155.  It happens frequently especially when using the paginator plugin.

This simple patch stops the recursion from getting into the infinite loop.