Allows to append entities to a resource

Currently the only ways to change the entities of a resource is to
replace all the entities with PATCH call on the resource.

This change allows to append new entities to a resource without touching
entities already associated with it.

We also add a uniq constraint for resource/entity_name to enforce the
uniqueness of the entity name on a resource and also add the index of
the id key of resources to make mysql happy...

Change-Id: Ia110a7289483b1c8724ab084dd1a7f1846fa593a
Merge "Allows to append entities to a resource"