Engine control modules replaced on a newer car

I've recently bought this pre-owned car, which is a 2014 model. Despite being a newer car, it has developed some serious engine problems. One day, I was driving a relatively long distance of about 50 miles. It started having troubles so I took it to the dealership. They had the powertrain control module and the engine control unit replaced. I'm very concerned about the vehicle as it is fairly new and both engine modules have been replaced already. I guess I need your advice. Should I keep the car or sell it? What kind of problems can I expect in the future if I keep the car?

– Engine control modules replaced on a newer car