saveLayer function

Saves the details of an existing layer