Refactoring: reduce duplicate code for initializing crud stubs