public void Create(RoleTypeView roleTypeView, long structure) { if (roleTypeView == null) throw new ArgumentNullException("roleTypeView"); var roleType = roleTypeView.Convert(); var strucureObj = StructureManager.Get(_dbContext, structure); if (strucureObj == null) throw new ArgumentException("\"structure\" is a invalid argument"); roleType.Structure = strucureObj; _dbContext.RoleTypes.Add(roleType); _dbContext.SaveChanges(); }