private void useFacebookProfileImage(Connection<Facebook> connection, Account account, WebRequest request) {
if (request.getAttribute(USE_FACEBOOK_IMAGE_ATTRIBUTE, WebRequest.SCOPE_SESSION) != null) {
try {
profilePictureService.saveProfilePicture(account.getId(), connection.getApi().userOperations().getUserProfileImage());
} catch (IOException e) {
NativeWebRequest nativeRequest = (NativeWebRequest) request;
HttpServletRequest servletRequest = nativeRequest.getNativeRequest(HttpServletRequest.class);
FlashMap flashMap = RequestContextUtils.getOutputFlashMap(servletRequest);
flashMap.put("message", Message.warning("Greenhouse was unable to use your Facebook profile picture."));
}
request.removeAttribute(USE_FACEBOOK_IMAGE_ATTRIBUTE, WebRequest.SCOPE_SESSION);
}