refactored management engine (save mgmt ks in db)