/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Id == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } if (Type == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Type"); } if (Description == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Description"); } if (Balances == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Balances"); } if (ApiKey == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ApiKey"); } if (Balances != null) { Balances.Validate(); } }