public static Remark CreateRemark(Guid id, string name, string nameOnApplication, string description, RemarkIcon icon, IEnumerable <DefaultRemark> defaultRemarks, IEnumerable <Tag> tags) { // prepare var writeRepository = new RemarkWriteRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); var readRepository = new RemarkReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); // create var remark = new Remark(id, name, nameOnApplication, description, icon); foreach (var defaultRemark in defaultRemarks) { remark.AddDefaultRemark(defaultRemark); } foreach (var tag in tags) { remark.AddTag(tag); } writeRepository.CreateAsync(remark).GetAwaiter().GetResult(); // result var result = readRepository.GetAsync(id).Result; return(result); }