Checking for User Permissions and Getting UnauthorizedAccessException