changes to saving database document