To create content in EPiServer, you need to use an instance of IContentRepository instead of the new operator:
var repo = ServiceLocator.Current.GetInstance<IContentRepository>();
After that, you can add the block to the content area:
EPiServer creates proxy objects for blocks at runtime and implements the IContent interface. When you need to use the IContent element in a block, explicitly specify its IContent .
When creating blocks using the new operator, they are not stored in the database. Another problem is that the content area does not accept such objects, since they do not implement IContent intefrace (you need to get blocks from IContentRepository that proxies create at runtime).
source share