Fix delete cascade for attribute and counts

Change-Id: Ic355a215d576565688c1b9ef1976ff998c799d8e
Closes-Bug: #1278396
Merge "Fix delete cascade for attribute and counts"