Code successfully writes to both databases