before_insert handler implemented