refactored service constructor to support nested resources