adding empty constructor to ResourceWithUrl in the case of returning errors.
refactoring of controller to remove duplication