private Exception GetNotAllowedContentTypeExceptionOnCreate(Node node, GenericContent parent)
{
var ancestor = parent;
while (ancestor.NodeType.Name == "Folder" || ancestor.NodeType.Name == "Page")
{
var p = ancestor.Parent as GenericContent;
if (p == null)
break;
ancestor = p;
}
var contentTypeName = node.NodeType.Name;
var nodePath = String.Concat(node.Parent.Path, "/", node.Name);
return new InvalidOperationException(String.Format("Cannot save the content '{0}' because its ancestor does not allow the type '{1}'. Ancestor: {2} ({3}). Allowed types: {4}"
, nodePath, contentTypeName, ancestor.Path, ancestor.NodeType.Name, String.Join(", ", parent.GetAllowedChildTypeNames())));
}
private Exception GetNotAllowedContentTypeExceptionOnMove(Node node, GenericContent target)