Check null of val in toDatabase