public async Task <T> Insert(T entity) { var result = default(int); BaseEntity entityIN = null; try { entityIN = entity as BaseEntity; if (entityIN.Id.Equals(0)) { entityIN.CreatedDate = DateTime.UtcNow; result = await _dataLayer.AddEntityAsync <T>(_queryBase, BuildParameterList(entity, false), _methodName); entityIN.Id = result; } } catch (Exception ex) { throw ex; } return(entityIN as T); }