Preparation of nitrogen-containing carbohydrates