public static Mission ToMission(this MissionModel model) { Mission mission = null; if (model.GetType() == typeof(NewObservationMissionModel)) { mission = ((NewObservationMissionModel)model).ToNewObersationMission(); } else if (model.GetType() == typeof(VerificationMissionModel)) { mission = ((VerificationMissionModel)model).ToVerificationMission(); } else if (model.GetType() == typeof(IdentificationMissionModel)) { mission = ((IdentificationMissionModel)model).ToIdentificationMission(); } mission.Id = model.Id; mission.Title = model.Title; mission.Description = model.Description; mission.EndingCondition = model.EndingCondition?.ToEndingCondition(); mission.RestrictedArea = model.RestrictedArea?.ToRestrictedArea(); return(mission); }