I have been trying to write some generic code to create an xml package of Habanero business objects. The code can currently handle compostion relationships, but I need to add the Association relationships manually. Is there any way to add association relationsips that don't have a composite reverse relationship in a more generic way.
This is how the composition relationships are added
    private static void AddRelatedCompositionObjects(Package package, IBusinessObject businessObject)
    {
        businessObject.Relationships
            .Where(rel => rel.RelationshipType == RelationshipType.Composition)
            .Where(rel => rel is IMultipleRelationship)
            .Select(rel => (IMultipleRelationship)rel)
            .ForEach(rel => rel.BusinessObjectCollection
                                .AsEnumerable<IBusinessObject>()
                                //.ForEach(package.Add));
                                .ForEach(bo => BuildPackage(package, bo)));
        businessObject.Relationships
            .Where(rel => rel.RelationshipType == RelationshipType.Composition)
            .Where(rel => rel is ISingleRelationship)
            .Select(rel => (ISingleRelationship)rel)
            //.ForEach(rel => package.Add(rel.GetRelatedObject()));
            .ForEach(rel => BuildPackage(package, rel.GetRelatedObject()));
    }
And then I manually add the association relationships
                var package = new Package();
                foreach (var returnDelivery in returnDeliveries)
                {
                    package.Add(returnDelivery);
                    if (returnDelivery != null)
                    {
                        var materials = returnDelivery.DeliveryItems.Select(item => item.Material).Distinct();
                        materials.ToList().ForEach(material =>
                        {
                            package.Add(material);
                            material.EWTMaterials.ForEach(package.Add);
                        });
                        package.Add(returnDelivery.Customer);
                    }
                }