static void validatePartner(Rbr_Db pDb, PartnerDto pPartner) { if (pPartner.ContactInfo != null) { if (pPartner.ContactInfo.Email.Length > 256) { throw new ArgumentException("Email Address is too long (max lenght 256): [" + pPartner.ContactInfo.Email + "]"); } string _formatedEmailString = string.Empty; if (pPartner.ContactInfo.Email.Length > 0) { if (!EmailValidator.ValidateAndFormat(pPartner.ContactInfo.Email, true, out _formatedEmailString)) { throw new ArgumentException("Invalid Email Address: [" + pPartner.ContactInfo.Email + "]"); } } pPartner.ContactInfo.Email = _formatedEmailString; } }