public void updates_EventType()
        {
            //setup
            var request = new UpdateEventTypeRequest();
            request.Id = _existingEventTypeId;
            request.IsEnabled = false;
            request.Name = _updatedEventName;

            var handler = CreateHandler();

            //act
            var response = HandleRequest<UpdateEventTypeResponse>(handler, request);

            //assert
            using (var context = _objectContextFactory.CreateObjectContext())
            {
                context.ContextOptions.LazyLoadingEnabled = true;
                context.ContextOptions.ProxyCreationEnabled = true;
                var Event = context.CreateObjectSet<EventType>().Single(e => e.Id == _existingEventTypeId);

                Assert.AreEqual(request.Id, _existingEventTypeId);
                Assert.AreEqual(request.IsEnabled, false);
                Assert.AreEqual(request.Name, _updatedEventName);
            }
        }
        private void Save()
        {
            _eventTypeId = int.Parse(CommonUtils.GetFieldValue(_viewModel.Fields, _id), CultureInfo.InvariantCulture);

            var nameValue = CommonUtils.GetFieldValue(_viewModel.Fields, _name);
            var isEnabledValue = bool.Parse(CommonUtils.GetFieldValue(_viewModel.Fields, _isEnabled));

            if (string.IsNullOrEmpty(nameValue))
                throw new Exception("Event Type name is required.");

            if (_eventTypeId == 0)
            {
                var request = new AddEventTypeRequest
                {
                    Name = nameValue,
                    IsEnabled = isEnabledValue
                };

                _eventTypeId = ProcessRequest<AddEventTypeResponse>(request).Id;
            }
            else
            {
                if (_viewModel.Action == RecordActions.Edited)
                {
                    var updateRequest = new UpdateEventTypeRequest
                    {
                        Id = _eventTypeId,
                        Name = nameValue,
                        IsEnabled = isEnabledValue
                    };

                    ProcessRequest<UpdateEventTypeResponse>(updateRequest);
                }
            }
        }