diff --git a/src/Seq.Api/ResourceGroups/EntityResourceGroup.cs b/src/Seq.Api/ResourceGroups/EntityResourceGroup.cs index e1e51da..6bee541 100644 --- a/src/Seq.Api/ResourceGroups/EntityResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/EntityResourceGroup.cs @@ -13,9 +13,21 @@ internal EntityResourceGroup(string name, ISeqConnection connection) : base(name protected async Task GroupCreateAsync(TEntity entity, IDictionary parameters = null) where TEntity : ILinked { - var link = entity.Links.ContainsKey("Create") ? "Create" : "Items"; - var group = await LoadGroupAsync().ConfigureAwait(false); - return await Client.PostAsync(group, link, entity, parameters).ConfigureAwait(false); + ILinked resource; + string link; + + if (entity.Links.ContainsKey("Create")) + { + resource = entity; + link = "Create"; + } + else + { + resource = await LoadGroupAsync().ConfigureAwait(false); + link = "Items"; + } + + return await Client.PostAsync(resource, link, entity, parameters).ConfigureAwait(false); } } -} \ No newline at end of file +}