Fixed the permissions validation and added functionality to remove all the settings for the deleted module.