/// <summary>
        /// This method is called just before a node is created by the repository.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="properties">The new properties of the node.</param>
        protected override void DoBeforeCreate(IMansionContext context, IPropertyBag properties)
        {
            // check if the layout is set
            string layout;
            if (properties.TryGet(context, "layout", out layout))
                return;

            // set the layout
            properties.TrySet("layout", layout);
        }
        /// <summary>
        /// This method is called just before a node is created by the repository.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="parent">The parent node to which the new child will be added.</param>
        /// <param name="newProperties">The new properties of the node.</param>
        protected override void DoBeforeCreate(IMansionContext context, Node parent, IPropertyBag newProperties)
        {
            // check if the layout is set
            string layout;
            if (newProperties.TryGet(context, "layout", out layout))
                return;
            if (!parent.TryGet(context, "layout", out layout))
                layout = "OneColumnLayout";

            // set the layout
            newProperties.TrySet("layout", layout);
        }
		/// <summary>
		/// Prepares an insert query.
		/// </summary>
		/// <param name="context"></param>
		/// <param name="connection">The connection.</param>
		/// <param name="transaction">The transaction.</param>
		/// <param name="node"></param>
		/// <param name="modifiedProperties"></param>
		/// <returns></returns>
		public void Prepare(IMansionContext context, SqlConnection connection, SqlTransaction transaction, Node node, IPropertyBag modifiedProperties)
		{
			// validate arguments
			if (connection == null)
				throw new ArgumentNullException("connection");
			if (transaction == null)
				throw new ArgumentNullException("transaction");
			if (node == null)
				throw new ArgumentNullException("node");
			if (modifiedProperties == null)
				throw new ArgumentNullException("modifiedProperties");

			// set the modified date
			modifiedProperties.TrySet("modified", DateTime.Now);

			// retrieve the type
			var type = typeService.Load(context, node.Pointer.Type);

			// retrieve the schema
			var schema = Resolver.Resolve(context, type);

			// set the full text property
			SqlServerUtilities.PopulateFullTextColumn(context, type, modifiedProperties, node);

			// create the commandse
			command = connection.CreateCommand();
			command.CommandType = CommandType.Text;
			command.Transaction = transaction;

			// prepare the query
			var queryBuilder = new ModificationQueryBuilder(command);

			// loop through all the tables in the schema and let them prepare for update
			foreach (var table in schema.Tables)
				table.ToUpdateStatement(context, queryBuilder, node, modifiedProperties);

			// finish the insert statement
			command.CommandText = queryBuilder.ToStatement();
		}