Incredibly useful post by Mark Vale(@unifiedvale) on how to recover from a corrupt CMS. Please do note the points in the article about making a backup of your Lync environment. You never know when you need it.
Implementing backup of your Lync/Skype for Business environment can be accomplished in many ways. Please check out MVP Lasse Wedoe’s blog on how to as one of several resources.