public void Dequeue(EmailMessageDto item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item", "The email message must be contains a valid instance");
            }

            if (item.Id < 1)
            {
                throw new ArgumentException("The item Id must be greater than 0", "item.Id");
            }

            EmailMessage emailToDelete = this.Session.Load<EmailMessage>(item.Id);

            this.Session.Delete(emailToDelete);
        }
        public void Queue(EmailMessageDto item)
        {
            EmailMessage message;

            if (item.Id > 1)
            {
                message = this.Session.Load<EmailMessage>(item.Id);
                item.MapPropertiesToInstance(message);
                message.RetryCount++;
            }
            else
            {
                message = item.MapTo<EmailMessage>();
            }

            message.Status = null;

            this.Session.Store(message);
        }