Fixed the update of references table and delete files for models that are
not needed.