public IHttpActionResult Post(Guid companyId, AnnouncementInputModel model) { Severity severity = (Severity)Enum.Parse(typeof(Severity), model.Severity, true); var announcement = new Announcement(companyId, model.Message, model.Name, severity, model.StartDate, model.EndDate); if (model.IsActive.HasValue && model.IsActive.Value) { announcement.Activate(); } else if (model.IsActive.HasValue && !model.IsActive.Value) { announcement.Deactivate(); } AnnouncementRepository.Add(announcement); return Created(new Uri(Url.Link("GetAnnouncement", new { companyId = announcement.CompanyId, announcementId = announcement.Id })), AnnouncementModel.From(announcement)); }