public static int Add(Form form) { Form form2 = GetForm(form.Code); if (form2 != null) throw new Exception("There is another form has the same code, please choose another code"); return FormDataMapper.Add(form); }