if you want to glue it to a rock it wont be a problem at all, you said its attached to sand right? just dry the sand and glue the sand to a rock. the coral being attached to the sand will stay, same tecnique is used for mushrooms wich are WAYYYY to slimy to glue, I also use that trick on some of the harder to glue protopalythoas, regular pays and zoas dont need sand but protopalys are far tougher to glue.