internal override IO.Item Commit() { if (!this.Completed) { IO.Item dbitem = this.BuildItem(); IO.Response response = this.SendItem(dbitem); if (!response.IsError) { if (response.Items.Count() == 1) { this.Result = response.Items.First(); if (this.Result.ConfigID.Equals(this.Item.ConfigID)) { if (!this.Result.ID.Equals(this.Item.ID)) { // New Version of Item Model.Item newversion = this.Item.Store.Get(this.Result.ID); Model.Item oldversion = this.Item; this.Item = newversion; this.UpdateItem(this.Result); oldversion.OnSuperceded(newversion); } else { this.UpdateItem(this.Result); } } else { // Result does not match Item throw new Exceptions.ServerException("Server response does not match original Item"); } } this.Completed = true; } else { this.Completed = true; if (response.ErrorMessage != "Aras.Server.Core.ItemIsNotLockedException") { throw new Exceptions.ServerException(response); } } } return(this.Result); }