code: public static Collection getEmbeddedCollectionInstance(Field embeddedCollectionField)
      {
          Collection embeddedCollection = null;
          Class embeddedCollectionFieldClass = embeddedCollectionField.getType();
  
          if (embeddedCollection == null || embeddedCollection.isEmpty())
          {
              if (embeddedCollectionFieldClass.equals(List.class))
              {
                  embeddedCollection = new ArrayList<Object>();
              }
              else if (embeddedCollectionFieldClass.equals(Set.class))
              {
                  embeddedCollection = new HashSet<Object>();
              }
              else
              {
                  throw new InvalidEntityDefinitionException("Field " + embeddedCollectionField.getName()
                          + " must be either instance of List or Set");
              }
          }
          return embeddedCollection;
      }
docs: Gets the embedded collection instance.
  
  @param embeddedCollectionField
  the embedded collection field
  @return the embedded collection instance