public async Task<Activity> SaveActivity(Activity activity)
 {
     var json = Serializer.SerializeToJson(activity);
     var response = await authorisationManagerService.SaveActivity(json).ConfigureAwait(false);
     activity = ServiceResponse.Deserialize<Activity>(response);
     return activity;
 }
 public Activity SaveActivity(Activity activity)
 {
     return authorisationManagerServiceData.SaveActivity(activity);
 }
        private static bool CanPerformActivityCheck(Activity activity, string activityCode)
        {
            if (activity.Activities.Any(a => a.ActivityCode.ToUpper().Equals(activityCode.ToUpper())))
            {
                return true;
            }

            foreach (var child in activity.Activities)
            {
                if (CanPerformActivityCheck(child, activityCode))
                {
                    return true;
                }
            }

            return false;
        }
        public ActivityNode(Activity activity)
        {
            Activity = activity;

            Activities = new ObservableCollection<ActivityNode>();
        }
        public Activity SaveActivity(Activity activity)
        {
            var isInsert = activity.Id.Equals(0);

            using (var conn = new SqlConnection(ConnectionString))
            {
                if (isInsert)
                {
                    activity = conn.Insert(activity, "Id");
                }
                else
                {
                    conn.Update(activity, new Dictionary<string, object>() {{"Id", activity.Id}}, new[] {"Id"});
                }
            }

            return activity;
        }
        private ActivityNode GetActivityNode(Activity activity)
        {
            var activityNode = new ActivityNode(activity);
            activity.Activities.ToList().ForEach(a =>
            {
                var an = GetActivityNode(a);
                an.ParentId = activity.Id;
                an.ParentType = ParentType.ActivityNode;

                activityNode.Activities.Add(an);
            });
            return activityNode;
        }