/// <summary>
        /// Updates an existing item in the database.
        /// </summary>
        /// <param name="entity">
        /// The entity.
        /// </param>
        protected override void PersistUpdatedItem(IPayment entity)
        {
            ((Entity)entity).UpdatingEntity();

            var factory = new PaymentFactory();
            var dto     = factory.BuildDto(entity);

            Database.Update(dto);

            entity.ResetDirtyProperties();
        }
        /// <summary>
        /// Saves a new item to the database.
        /// </summary>
        /// <param name="entity">
        /// The entity.
        /// </param>
        protected override void PersistNewItem(IPayment entity)
        {
            ((Entity)entity).AddingEntity();

            var factory = new PaymentFactory();
            var dto     = factory.BuildDto(entity);

            Database.Insert(dto);
            entity.Key = dto.Key;
            entity.ResetDirtyProperties();
        }