Fixed sha1 generation & sorting for profiles.

Profiles are now unique according to entity_id, event_type and
timestamp.

Fixed sorting for when event_type is the same, then it sorts by date.