title: Getting Error When saving changes in database in asp.net mvc4
body: <p><img src="https://i.stack.imgur.com/mmAup.png" alt="enter image description here">This my one method primaryKey of my model is 'PlanetKey'</p>
  
  <pre><code>        Graph graph = new Graph();
          long lastGraphID = 1000;
          //graph.GraphID = lastGraphID;
          graph.ItemType = enumType;
          graph.GraphItemTitle = title;
          graph.GraphItemDescription = statusMessage;
          graph.GraphItemUserFullName = null;
          graph.GraphItemURL = url;
          graph.ItemSummary = title + ": " + statusMessage; ;
          graph.ItemCreatedOn = DateTime.UtcNow.ToLocalTime();
          //graph.GraphID = lastGraphID;
          graph.GraphCustomURL = null;
          graph.DbType = "OFFLINE";
          graph.ItemOwnerGraphID = ItemOwnerGraphID;
          graph.ItemUserID = userInfoId;
          graph.PRIMARYTaggedAcademicTreeNodeId = 0;
          graph.PRIMARYTaggedAcademicTreeSerialNumber = "1";
          graph.PRIMARYTaggedCareerTreeNodeId = 0;
          graph.PRIMARYTaggedCareerTreeSerialNumber = "1";
          graph.PRIMARYTaggedSkillTreeNodeId = 0;
          graph.PRIMARYTaggedSkillTreeSerialNumber = "1";
          graph.PRIMARYTaggedAcademicTreeNodeId = 0;
          graph.PRIMARYTaggedAcademicTreeSerialNumber = "1";
          graph.PRIMARYTaggedToolTreeNodeId = 0;
          graph.PRIMARYTaggedToolTreeSerialNumber = "1";
          graph.CountReactions = 0;
          graph.CountResponses = 0;
          graph.CountRatings = 0;
          graph.AverageRating = 0;
          graph.CountRatings = 0;
          graph.CountUses = 0;
          graph.CountViews = 0;
          graph.isReported = false;
          graph.isPSKverified = false;
          graph.isPSKbanned = false;
          graph.isPSKresource = false;
          graph.AccessAllowedCode = 0;
          graph.AgeRestrictionCode = loginUserCurrentAge;
          graph.isHidden = false;
  
          GraphsController GraphsControllerObject = new GraphsController();
          long returnGraphId = GraphsControllerObject.CreateGraphIdByModel(graph);
  </code></pre>
  
  <p>this is another what i am calling to</p>
  
  <pre><code>public long CreateGraphIdByModel(Graph graph)
          {
             try
             {
                  if (ModelState.IsValid)
                  {
                      db.Graphs.Add(graph);
                      db.SaveChanges();
                      return graph.GraphID;
                  }
             }
             catch (DataException)
             {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
             }            
              return graph.GraphID;
          }
  </code></pre>
  
  <p>this is showing me eeror in db.SaveChanges()
  what m i doing wrong with this code i just wanna pass my parameter using model as crud of mvc4</p>
  
  <p><img src="https://i.stack.imgur.com/qL5nf.png" alt="enter image description here"></p>