Hello Mmad... Pitluvs messaged me, but it looks like I am too late- I am so sorry he did not make it. It was very sweet of you to try to help him, and you had at least given him a better last few hours.
She did give you the right treatment of Epsom Salt- as anything else wouldn't of worked at the point he was at. Epsom was really the only thing that had the chance of getting him right side up. Unfortunately though, he may of had SBD, but the red spots and such you mentioned is making think he may of had ammonia burns/poisoning as well- which there really is no true treatment and normally is deadly.
There really was nothing you could of done, other then what you did and that was to make him comfortable.
If you decide to get another betta, please feel free to come and ask any questions needed, such as accurate water changes, temp, etc.
I'm sorry once more.. and thank you for doing all you could for the little guy.