public T Add(T entity) { try { entity.Id = GenerateId(entity); return(_fileContext.CreateItem(entity)); } catch (FileContextException e) { if (e.Code == FileContextExceptionCode.ItemConflict) { throw new EntityAlreadyExistsException(); } throw; } }