public virtual async Task <TModel> Create(TModel modelToCreate) { var entity = await _provider.RetrieveAsync(modelToCreate.Key); if (entity != null) { throw new ExceptionWithFeedback("EAE", $"The entity of type '{typeof(TModel).Name}' with key '{modelToCreate.Key}' already exists."); //todo update to EntityAlreadyExists exception } await _provider.PersistAsync(modelToCreate); return(await Get(modelToCreate.Key)); }