// A transaction script
        public void CalculateRevenueRecognitions(long contractNumber)
        {
            var contracts = _gateway.FindContract(contractNumber);

            contracts.Read();
            var totalRevenue    = Money.Dollars(contracts.GetDouble(0));
            var recognitionDate = contracts.GetDateTime(1);

            // Here comes the real domain logic in this example.
            // These rules may be simple enough for a transaction script,
            // but if the rules become much more complicated, consider using a Domain Model
            string type = contracts.GetString(2);

            if (type == "S")
            {
                var allocation = totalRevenue.Allocate(3);
                _gateway.InsertRecognition(contractNumber, allocation[0], recognitionDate);
                _gateway.InsertRecognition(contractNumber, allocation[1], recognitionDate.AddDays(60));
                _gateway.InsertRecognition(contractNumber, allocation[2], recognitionDate.AddDays(90));
            }
            else if (type == "W")
            {
                _gateway.InsertRecognition(contractNumber, totalRevenue, recognitionDate);
            }
            else if (type == "D")
            {
                var allocation = totalRevenue.Allocate(3);
                _gateway.InsertRecognition(contractNumber, allocation[0], recognitionDate);
                _gateway.InsertRecognition(contractNumber, allocation[1], recognitionDate.AddDays(30));
                _gateway.InsertRecognition(contractNumber, allocation[2], recognitionDate.AddDays(60));
            }
        }