public void Create(ContainerPrototypeView containerPrototypeView, long structure) { if (containerPrototypeView == null) throw new ArgumentNullException("containerPrototypeView"); var containerPrototype = containerPrototypeView.Convert(); var structureObj = StructureManager.Get(_dbContext, structure); if (structureObj == null) throw new ArgumentException("\"structure\" is a invalid argument"); containerPrototype.Structure = structureObj; _dbContext.ContainerPrototypes.Add(containerPrototype); _dbContext.SaveChanges(); }