/// <summary>
        /// Updates process filter.
        /// </summary>
        /// <param name="dto">The DTO object.</param>
        /// <param name="locDto">The localization DTO object.</param>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.Data.DBConcurrencyException"></exception>
        /// <exception cref="DBConcurrencyException">Indicates stale data.</exception>
        public void UpdateProcessFilterWithLocalization(ProcessFilterEditDto dto, ProcessFilterLocalizationDto locDto)
        {
            if (dto == null) throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto"));

            const string CommandText =
    @"
UPDATE [dbo].[Filters]
SET
     [LastModifiedOn]               = @p_LastModifiedOn
    ,[GuidId]                       = @p_GuidId
    ,[FilterDefinition]             = @p_FilterExpression
    ,[RoleIds]                      = @p_RoleIds
WHERE [Id] = @p_Id;
";
            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                var connection = ctx.Connection;

                using (var command = new SqlCommand(CommandText, connection))
                {
                    command.Parameters.AddWithValue("@p_Id", dto.Id);
                    command.Parameters.AddWithValue("@p_LastModifiedOn", dto.LastModifiedOn);
                    command.Parameters.AddWithValue("@p_GuidId", dto.GuidId);
                    command.Parameters.AddWithValue("@p_FilterExpression", dto.FilterDefinition);
                    command.Parameters.AddWithValue("@p_RoleIds", dto.RoleIds ?? (object)DBNull.Value);

                    if (command.ExecuteNonQuery() == 0)
                    {
                        throw new DBConcurrencyException(Resources.StaleDataException);
                    }
                }
            }

            UpdateProcessFilterLocalization(locDto);
        }
        /// <summary>
        /// Inserts process filter.
        /// </summary>
        /// <param name="dto">The DTO object.</param>
        /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception>
        public void InsertProcessFilter(ProcessFilterEditDto dto)
        {
            if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto"));

            const string CommandText =
    @"
INSERT  INTO [dbo].[Filters]
        ( [ProcessId] ,
          [LastModifiedOn] ,
          [GuidId] ,
          [Name] ,
          [Documentation] ,
          [FilterDefinition],
          [RoleIds]
        )
VALUES  ( @p_ProcessId ,
          @p_LastModifiedOn ,
          @p_GuidId ,
          @p_Name ,
          @p_Documentation ,
          @p_FilterExpression,
          @p_RoleIds
        );
SELECT  [Id]
FROM    [dbo].[Filters]
WHERE   [Id] = SCOPE_IDENTITY()";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                var connection = ctx.Connection;

                using (var command = new SqlCommand(CommandText, connection))
                {
                    command.Parameters.AddWithValue("@p_ProcessId", dto.ProcessId);
                    command.Parameters.AddWithValue("@p_LastModifiedOn", dto.LastModifiedOn);
                    command.Parameters.AddWithValue("@p_GuidId", dto.GuidId);
                    command.Parameters.AddWithValue("@p_Name", dto.Name);
                    command.Parameters.AddWithValue("@p_Documentation", dto.Documentation);
                    command.Parameters.AddWithValue("@p_FilterExpression", dto.FilterDefinition);
                    command.Parameters.AddWithValue("@p_RoleIds", dto.RoleIds ?? (object)DBNull.Value);

                    dto.Id = (int)command.ExecuteScalar();
                }
            }
        }