Wrote save avatar functionality