refactor base crud