Public Class LicenseCreator
    Public Shared Function NewUser(Type As UserType, Count As Integer, Optional ValidUntil As Date = Nothing) As LicenseModuleUser
        Dim oValidUntilSpecified = Not IsNothing(ValidUntil)
        Dim oTest = IsNothing(ValidUntil)

        Return New LicenseModuleUser() With {
            .Count = Count,
            .Type = Type,
            .Test = oTest,
            .ValidUntil = ValidUntil,
            .ValidUntilSpecified = oValidUntilSpecified
        }
    End Function

    Public Shared Function NewModule(Name As String, Users As List(Of LicenseModuleUser), Optional ValidUntil As Date = Nothing) As LicenseModule
        Dim oUsers = Users.ToArray()
        Dim oValidUntilSpecified = Not IsNothing(ValidUntil)

        Return New LicenseModule() With {
            .Name = Name,
            .Users = oUsers,
            .ValidUntil = ValidUntil,
            .ValidUntilSpecified = oValidUntilSpecified
        }
    End Function

    Public Shared Function NewLicense(Modules As List(Of LicenseModule)) As LicenseSchema
        Dim oModules = Modules.ToArray()

        Return New LicenseSchema With {
            .Modules = oModules
        }
    End Function
End Class
