Do you understand why you had the affair? What needs were not being met? Did you try to discuss with H? After that, did you try to rebuild trust? It sounds like you got into the texting thing with your trainer, and while your H wanted to trust you, you continued to tear it down. Do you know why? I totally understand the bit about not feeling like you deserve the love...dig into that. Figure out why.
With regards to the detaching, remember what attracted your H to you in the first place....I'm sure you were happy and confident. You need to get back to that. You can't go chasing him around or begging him to come back....start it easy, be happy, confident...a flirty friend.