Improved plugin manager to handle foreign key constraints improving dependency checking.