public void Serialize(bool hasCategory)
        {
            var category      = new CategoryEntityImp();
            var standingOrder = new StandingOrderEntityImp(ApplicationContext)
            {
                Category        = hasCategory ? category : null,
                Description     = "Test",
                FirstBookDate   = new DateTime(2015, 4, 1),
                LastBookDate    = new DateTime(2016, 4, 1),
                LastBookedDate  = new DateTime(2015, 5, 1),
                MonthPeriodStep = 1,
                ReferenceDay    = 1,
                ReferenceMonth  = 4,
                Value           = 45.22
            };
            var standingOrderPersistence = new StandingOrderEntityPersistence(standingOrder);

            var data = standingOrderPersistence.Serialize();

            Assert.That(data.Attribute("CategoryId").Value, Is.EqualTo(hasCategory ? category.PersistentId : string.Empty));
            Assert.That(data.Attribute("Description").Value, Is.EqualTo("Test"));
            Assert.That(data.Attribute("FirstBookDate").Value, Is.EqualTo(standingOrder.FirstBookDate.ToString(CultureInfo.InvariantCulture)));
            Assert.That(data.Attribute("LastBookDate").Value, Is.EqualTo(standingOrder.LastBookDate.ToString(CultureInfo.InvariantCulture)));
            Assert.That(data.Attribute("LastBookedDate").Value, Is.EqualTo(standingOrder.LastBookedDate.ToString(CultureInfo.InvariantCulture)));
            Assert.That(data.Attribute("MonthPeriodStep").Value, Is.EqualTo(standingOrder.MonthPeriodStep.ToString(CultureInfo.InvariantCulture)));
            Assert.That(data.Attribute("ReferenceDay").Value, Is.EqualTo(standingOrder.ReferenceDay.ToString(CultureInfo.InvariantCulture)));
            Assert.That(data.Attribute("ReferenceMonth").Value, Is.EqualTo(standingOrder.ReferenceMonth.ToString(CultureInfo.InvariantCulture)));
            Assert.That(data.Attribute("Value").Value, Is.EqualTo(standingOrder.Value.ToString(CultureInfo.InvariantCulture)));
        }