protected UserProfile GetUser(int id, bool performOwnerCheck) { var user = _repository.Get <UserProfile>(id); if (user == null) { throw new HttpException(404, "User {0} not found".F(id)); } if (performOwnerCheck && !_currentUser.Is(user) && !_currentUser.IsAdmin) { throw new ApplicationException("You are not {0}".F(id)); } return(user); }