refactoring crud