Added function for saving moves into database