Add branches in BaseController and fix bug in create function