Add sort by last activity to the API

Change-Id: I822462027165eb26c254eb5b457c161fc6c5076d