public CreateEntityResult StoreEntity(object Entity) { try { if (_barDatabaseAccess.TableExists(Entity.GetType().Name) == false) { _barDatabaseAccess.CreateEntityStorageMechanism(Entity); _barDatabaseAccess.CreateEntity(Entity); return(CreateEntityResult.Success); //return CreateEntityResult.EntityStorageStructureMissing; } else if (_barDatabaseAccess.DoesEntityWithSameUniqueKeyExist(Entity) == true) { return(CreateEntityResult.EntityWithUniqueKeyRecordExists); } else if (_barDatabaseAccess.DoesEntityWithSamePrimaryKeyExist(Entity) == true) { return(CreateEntityResult.EntityWithPrimaryKeyRecordExists); } else { _barDatabaseAccess.CreateEntity(Entity); return(CreateEntityResult.Success); } } catch (Exception ex) { throw new RecordCreationException($"Storing of Entity Type Failed: Type {Entity} : Object : " + ObjectToJson(Entity), ex); } }