ensuring null entries aren't inserted in to the database