private void AddUnpublishedData(ref Wiki actualWiki, ref Wiki unpublishedWiki) { //add local spaces and pages if (unpublishedWiki != null) { //add unexistent spaces from old structure //and update existing spaces with unpublished pages foreach (Space sp in unpublishedWiki.spaces) { if (actualWiki.ContainsSpace(sp.name)) { //The old local space containing local unpublished documents. Space existingSpace = actualWiki[sp.name]; foreach (XWikiDocument xwd in sp.documents) { existingSpace.documents.Add(xwd); } existingSpace.published = true; } else { sp.published = false; actualWiki.spaces.Add(sp); } } } }