public HttpContent GetPostContent <TEntity, TResource>(string contentType) where TEntity : IHasIdentifier, IDateVersionedEntity, new() where TResource : new() { // Get the "GetById" repository operation var getEntityById = _currentFeatureContext.Container() .Resolve <IGetEntityById <TEntity> >(); // Retrieve an "existing" entity var entityForUpdate = getEntityById.GetByIdAsync(Guid.NewGuid(), CancellationToken.None).GetResultSafely(); // Map the "updated" entity to a full School resource var mapperMethod = GetMapperMethod <TEntity>(); dynamic fullResourceForUpdate = new TResource(); mapperMethod.Invoke( null, new object[] { entityForUpdate, fullResourceForUpdate, null }); //empty the id for the Post operation fullResourceForUpdate.Id = Guid.Empty; //build post content return(new StringContent(JsonConvert.SerializeObject(fullResourceForUpdate), Encoding.UTF8, contentType)); }