/// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (PayerInfo != null)
     {
         PayerInfo.Validate();
     }
     if (ContributionType != null)
     {
         if (ContributionType.Length > 1)
         {
             throw new ValidationException(ValidationRules.MaxLength, "ContributionType", 1);
         }
     }
     if (PeriodId != null)
     {
         if (PeriodId.Length > 2)
         {
             throw new ValidationException(ValidationRules.MaxLength, "PeriodId", 2);
         }
     }
     if (PaymentTypeId != null)
     {
         if (PaymentTypeId.Length > 1)
         {
             throw new ValidationException(ValidationRules.MaxLength, "PaymentTypeId", 1);
         }
     }
 }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (PayerInfo == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "PayerInfo");
     }
     if (FormCode == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "FormCode");
     }
     if (PeriodId == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "PeriodId");
     }
     if (PeriodType == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "PeriodType");
     }
     if (PayerInfo != null)
     {
         PayerInfo.Validate();
     }
     if (FormCode != null)
     {
         if (FormCode.Length > 7)
         {
             throw new ValidationException(ValidationRules.MaxLength, "FormCode", 7);
         }
     }
     if (PeriodId != null)
     {
         if (PeriodId.Length > 7)
         {
             throw new ValidationException(ValidationRules.MaxLength, "PeriodId", 7);
         }
     }
     if (PeriodType != null)
     {
         if (PeriodType.Length > 7)
         {
             throw new ValidationException(ValidationRules.MaxLength, "PeriodType", 7);
         }
     }
     if (ObligationId != null)
     {
         if (ObligationId.Length > 40)
         {
             throw new ValidationException(ValidationRules.MaxLength, "ObligationId", 40);
         }
     }
 }