protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <ContactInfo> lstContactInfo = ContactInfoList; if (lstContactInfo.Count == 0) { ContactInfo newContactInfo = new ContactInfo(); lstContactInfo.Add(newContactInfo); } SetDataFromControlToObj(ref lstContactInfo); CustomList <ContactType> lstContactType = (CustomList <ContactType>)ContactTypeList; CustomList <ContactTypeChild> lstContactTypeChild = (CustomList <ContactTypeChild>)ContactTypeChildList; CustomList <ContactDetail> lstContactDetail = (CustomList <ContactDetail>)ContactDetailList; if (!CheckUserAuthentication(lstContactInfo)) { return; } manager.SaveContactInfo(ref lstContactInfo, ref lstContactType, ref lstContactTypeChild, ref lstContactDetail); ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); } catch (SqlException ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }