Fixed an issue in edit permission where I was not checking if the permission already exist.