public PreferencesAddApiKeyActionResponse execute(PreferencesAddApiKeyAction action) throws Exception {
Long apiKeyUserID;
try {
apiKeyUserID = Long.valueOf(action.getApiKeyUserID());
} catch (NumberFormatException nfe) {
throw new InvalidApiKeyException(action.getApiKeyUserID(), ErrorCode.INVALID_API_KEY_ID);
}
String apiKeyString = action.getApiKeyString();
if (apiKeyString.length() != 64) {
throw new InvalidApiKeyException(action.getApiKeyUserID(), ErrorCode.INVALID_API_KEY_ID);
}
clientFacade.createApiKey(apiKeyUserID, apiKeyString);
List<ApiKeyDto> apiKeys = clientFacade.getApiKeys();
UserDto user = clientFacade.getCurrentUser();
CharacterDto mainCharacter = user.getMainCharacter();