/// <summary>
        /// Deletes the eSync service index reference.
        /// </summary>
        /// <param name="dto">
        /// The data transfer object.
        /// </param>
        public void DeleteESyncServiceIndexReference(ESyncServiceIndexReferenceDto dto)
        {
            const string CommandText = @"
DELETE FROM [dbo].[ESyncServiceIndexReferences]
WHERE [ServiceId] = @serviceId AND [IndexId] = @indexId;";

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

            using (var ctx = GetConnectionManager())
            {
                using (var cmd = new SqlCommand(CommandText, ctx.Connection))
                {
                    cmd.Parameters.AddWithValue("@serviceId", dto.ServiceId);
                    cmd.Parameters.AddWithValue("@indexId", dto.IndexId);

                    var rowsAffected = cmd.ExecuteNonQuery();
                    if (rowsAffected == 0)
                        throw new DBConcurrencyException(ConcurencyException);
                }
            }
        }
        /// <summary>
        /// Inserts an eSync service index reference.
        /// </summary>
        /// <param name="dto">
        /// The data transfer object.
        /// </param>
        public void InsertESyncServiceIndexReference(ESyncServiceIndexReferenceDto dto)
        {
            const string CommandText = @"
INSERT INTO [dbo].[ESyncServiceIndexReferences]
(
     [ServiceId]
    ,[IndexId]
)
VALUES
(
     @serviceId
    ,@indexId
);";

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

            using (var ctx = GetConnectionManager())
            {
                using (var cmd = new SqlCommand(CommandText, ctx.Connection))
                {
                    cmd.Parameters.AddWithValue("@serviceId", dto.ServiceId);
                    cmd.Parameters.AddWithValue("@indexId", dto.IndexId);

                    var rowsAffected = cmd.ExecuteNonQuery();
                    if (rowsAffected == 0)
                        throw new DBConcurrencyException(ConcurencyException);
                }
            }
        }