Slice the tomatoes in half. Place a grater over a mixing bowl. Rub the cut surface of the tomatoes over the grater until all the flesh is grated. Discard the skins. Heat the oil in a medium saucepan over low heat. Add the onions, sugar, and salt. Cook, stirring occasionally, until the onions are soft and golden brown, about 45 minutes. You want the onions to caramelize, if they get too dark, add ½ teaspoon of water to keep them from burning. Stir in the tomato puree, the pimenton, and the bay leaves and cook for another 20 minutes over medium heat. You'll know the sofrito is ready when the tomato has broken down and deepened in color and the oil has separated from the sauce. Discard the bay leaves. Makes 3 cups of sauce.