CRM-14966 - ensure we have a contactid before inserting dashboard item.

----------------------------------------
* CRM-14966: inserting dashboard item using api from cli results in sql exception
  https://issues.civicrm.org/jira/browse/CRM-14966