working! saving history in server