code for create snapshot