public void AddResolutions(int templateId, ResolutionCollection resolutions)
        {
            var command = SqlDbAccess.CreateTextCommand();

            command.CommandText = @"
				INSERT INTO 
					[Cerberus.TemplateEngine.Resolution]
					(
						TemplateId,
						Width						
					)
				VALUES
					(
						@TemplateId,
						@Width
					);
				SELECT CAST(SCOPE_IDENTITY() AS INT);"                ;

            SqlDbAccess.AddParameter(command, "@TemplateId", SqlDbType.Int, templateId);

            var widthParameter = SqlDbAccess.AddParameter(command, "@Width", SqlDbType.Int, 0);

            foreach (var resolution in resolutions)
            {
                widthParameter.Value = resolution.ResolutionValue;

                resolution.Id = SqlDbAccess.ExecuteScalar <int>(command);
                this.UpdateResolutionValues(resolution.Id, resolution.TemplateControlVisualProperties);
            }
        }
        public int AddTemplate(Template template)
        {
            var command = SqlDbAccess.CreateTextCommand();

            command.CommandText = @"
				INSERT INTO 
					[Cerberus.TemplateEngine.Template]
					(
						Name,
						VisualProperties,
						CreatedByUserId,
						CreatedDate,
						LastModifiedDate
					)
				VALUES
					(
						@Name,
						@VisualProperties,
						@CreatedByUserId,
						GETDATE(),
						GETDATE()
					);

				DECLARE @IDENTITY INT;
				SELECT @IDENTITY=CAST(SCOPE_IDENTITY() AS INT);

				INSERT INTO
					[Cerberus.TemplateEngine.Resolution]
					(
						TemplateId
					)
				VALUES
					(
						@IDENTITY
					);

				SELECT @IDENTITY;"                ;

            SqlDbAccess.AddParameter(command, "@Name", SqlDbType.NVarChar, template.Name);
            SqlDbAccess.AddParameter(command, "@CreatedByUserId", SqlDbType.Int, template.CreatedByUserId);
            SqlDbAccess.AddParameter(command, "@VisualProperties", SqlDbType.NVarChar, template.VisualProperties);

            return(SqlDbAccess.ExecuteScalar <int>(command));
        }