It's done in Problem.pm. A file that BADLY needs refactoring. :-)
It occurs in the subroutine "body"
around line 980
the actual storing operation
is done by $db->putUserProblem( data_in_problem_format)
in lines 946--1009 the data is prepared and error messages are reported.