Modified registerObject to return id

Jira issue: WP-933