public async Task <List <object> > BulkImportAsync(string schemaName, string tableName, [FromBody] JArray collection) { var items = this.ParseCollection(collection); if (items == null || items.Count.Equals(0)) { return(null); } try { var repository = new FormRepository(schemaName, tableName, this.AppUser.Tenant, this.AppUser.LoginId, this.AppUser.UserId); return(await repository.BulkImportAsync(items).ConfigureAwait(false)); } catch (UnauthorizedException) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden)); } catch (DataAccessException ex) { throw new HttpResponseException ( new HttpResponseMessage { Content = new StringContent(ex.Message), StatusCode = HttpStatusCode.InternalServerError }); } #if !DEBUG catch { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } #endif }