title: Generate a Unique ID for an entity
body: <p>I'm working on Lagom project and one of the requirement is to uniquely identify each user's document.</p>
  
  <p>A document has an id that I should generate each time a user adds a document.</p>
  
  <p>My idea is simple to guarantee the unicity of the ID:</p>
  
  <ul>
  <li>generate a random string ID (NOT UUID)</li>
  <li>query the database for the generated ID </li>
  <li>IF query returns 0 hits THEN the ID is unique and I should return it to the caller </li>
  <li>IF query returns 1 hit THEN repeat all steps.</li>
  </ul>
  
  <p>I've implemented the <code>DocumentEventProcessor extends ReadSideProcessor&lt;DocumentEvent&gt;</code> and <code>DocumentRepository</code>
  to be able to query the database. </p>
  
  <p>My problem is how to write the function that iteratively (recursively maybe) query the database until new random ID returns.</p>