Added a helper method for performing a piece of code with an authenticated user.