private Appointment CreateAppointment(Event googleEvent) { Appointment appointment; if (googleEvent.Start.DateTime == null && googleEvent.End.DateTime == null) { appointment = new Appointment(googleEvent.Description, googleEvent.Location, googleEvent.Summary, DateTime.Parse(googleEvent.End.Date), DateTime.Parse(googleEvent.Start.Date), googleEvent.Id) { AllDayEvent = true }; } else { appointment = new Appointment(googleEvent.Description, googleEvent.Location, googleEvent.Summary, googleEvent.End.DateTime, googleEvent.Start.DateTime, googleEvent.Id); } if (googleEvent.Reminders != null) { if (!googleEvent.Reminders.UseDefault.GetValueOrDefault() && googleEvent.Reminders.Overrides != null) { appointment.ReminderSet = true; appointment.ReminderMinutesBeforeStart = googleEvent.Reminders.Overrides.First().Minutes.GetValueOrDefault(); } } //Getting Additional Data appointment.BusyStatus = googleEvent.Transparency != null && googleEvent.Transparency.Equals("transparent") ? BusyStatusEnum.Free : BusyStatusEnum.Busy; appointment.Privacy = AppointmentHelper.GetSensitivityEnum(googleEvent.Visibility); appointment.CalendarId = CalendarId; if (googleEvent.ExtendedProperties != null && googleEvent.ExtendedProperties.Private__ != null) { foreach (var property in googleEvent.ExtendedProperties.Private__) { appointment.ExtendedProperties.Add(property.Key, property.Value); } } appointment.Created = googleEvent.Created; appointment.LastModified = googleEvent.Updated; if (googleEvent.Organizer != null) { //Add Organizer appointment.Organizer = new Attendee { Name = googleEvent.Organizer.DisplayName, Email = googleEvent.Organizer.Email }; } //Add Required Attendee GetAttendees(googleEvent, appointment.RequiredAttendees, false); //Add optional Attendee GetAttendees(googleEvent, appointment.OptionalAttendees, true); return(appointment); }