Refactor webresources code

Simply the process searching for unique entities by using a generic
method.