codes refactoring for update/create notes