/// <summary>
        /// Inserts the integration service URL call settings.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <exception cref="System.ArgumentNullException">dto</exception>
        /// <exception cref="System.Data.DBConcurrencyException"></exception>
        public void InsertIntegrationServiceUrlCallSettings(IntegrationServiceUrlCallSettingsDto dto)
        {
            const string CommandText = @"
INSERT INTO [dbo].[IntegrationServiceUrlCallSettings]
(
     [SettingsId]
    ,[LastModifiedOn]
    ,[CallLocation]
    ,[HttpMethod]
    ,[Address]
)
VALUES
(
     @settingsId
    ,GETDATE()
    ,@callLocation
    ,@httpMethod
    ,@address
);

SET @id = SCOPE_IDENTITY();";

            if (dto == null)
                throw new ArgumentNullException("dto");

            using (var cmd = new SqlCommand(CommandText))
            {
                var idParam = cmd.Parameters.Add("@id", SqlDbType.Int);

                idParam.Direction = ParameterDirection.Output;

                cmd.Parameters.AddWithValue("@settingsId", dto.ParentSettingsId);
                cmd.Parameters.AddWithValue("@callLocation", dto.CallLocation.ToString());
                cmd.Parameters.AddWithValue("@httpMethod", dto.HttpMethod.ToString());
                cmd.Parameters.AddWithValue("@address", dto.Address);

                var rowsAffected = Database.Execute(cmd);

                if (rowsAffected == 0)
                    throw new DBConcurrencyException(ConcurencyException);

                dto.Id = (int)idParam.Value;
            }
        }
        /// <summary>
        /// Updates the integration service URL call settings.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <exception cref="System.ArgumentNullException">dto</exception>
        /// <exception cref="System.Data.DBConcurrencyException"></exception>
        public void UpdateIntegrationServiceUrlCallSettings(IntegrationServiceUrlCallSettingsDto dto)
        {
            const string CommandText = @"
UPDATE [dbo].[IntegrationServiceUrlCallSettings]
SET
     [SettingsId] = @settingsId
    ,[LastModifiedOn] = GETDATE()
    ,[CallLocation] = @callLocation
    ,[HttpMethod] = @httpMethod
    ,[Address] = @address
WHERE [Id] = @id;";

            if (dto == null)
                throw new ArgumentNullException("dto");

            using (var cmd = new SqlCommand(CommandText))
            {
                cmd.Parameters.AddWithValue("@id", dto.Id);
                cmd.Parameters.AddWithValue("@settingsId", dto.ParentSettingsId);
                cmd.Parameters.AddWithValue("@callLocation", dto.CallLocation.ToString());
                cmd.Parameters.AddWithValue("@httpMethod", dto.HttpMethod.ToString());
                cmd.Parameters.AddWithValue("@address", dto.Address);

                var rowsAffected = Database.Execute(cmd);

                if (rowsAffected == 0)
                    throw new DBConcurrencyException(ConcurencyException);
            }
        }
        /// <summary>
        /// Fetches the integration service URL call settings.
        /// </summary>
        /// <param name="parentSettingsId">The parent settings identifier.</param>
        /// <returns>IntegrationServiceUrlCallSettingsDto.</returns>
        public IntegrationServiceUrlCallSettingsDto FetchIntegrationServiceUrlCallSettings(int parentSettingsId)
        {
            const string CommandText = @"
DECLARE @settingsId INT;

SELECT @settingsId = [Id]
FROM
    [dbo].[IntegrationServiceUrlCallSettings]
WHERE [SettingsId] = @parentSettingsId;

SELECT
     [Id]
    ,[CallLocation]
    ,[HttpMethod]
    ,[Address]
FROM
    [dbo].[IntegrationServiceUrlCallSettings]
WHERE [Id] = @settingsId;

SELECT
     [Id]
    ,[Guid]
    ,[Name]
    ,[Value]
FROM
    [dbo].[IntegrationServiceUrlCallParameters]
WHERE [SettingsId] = @settingsId;";

            using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
            {
                using (var cmd = new SqlCommand(CommandText, ctx.Connection))
                {
                    cmd.Parameters.AddWithValue("@parentSettingsId", parentSettingsId);

                    using (var reader = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            var result = new IntegrationServiceUrlCallSettingsDto
                                             {
                                                 Id = reader.GetInt32(0),
                                                 CallLocation =
                                                     (UrlServiceCallLocation)
                                                     Enum.Parse(
                                                         typeof(UrlServiceCallLocation), reader.GetString(1), true),
                                                 HttpMethod =
                                                     (UrlServiceCallMethod)
                                                     Enum.Parse(
                                                         typeof(UrlServiceCallMethod), reader.GetString(2), true),
                                                 Address = reader.GetString(3)
                                             };

                            foreach (var parameter in ReadServiceUrlParameters(reader))
                                result.Parameters.Add(parameter);

                            return result;
                        }
                    }
                }
            }

            return null;
        }