Updated code to perform database calls for authorized view.