I have a 2004 nissan sentra and sometimes when I take the key out of the ignition the engine continues to run.
The ignition switch is probably the culprit http://www.autopartsway.ca/partlist.cfm?nissan/2004/sentra/base/1.8l-l4/allb/ignition/switches/ignition-starter-switch/pagenum1/tabs I suggest getting a new one from the dealership. It should not be more expensive than an OEM. Installation could be harder if the car has anti-theft on it.
Search Nissan Sentra Questions
Nissan Sentra Experts