public bool DeleteTag(Guid tagId)
        {
            if (tagId == Guid.Empty)
                throw new FaultException("Unable to delete tag because the passed in id was empty");

            TaskrDataContext db = new TaskrDataContext(ConfigurationProvider.GetConnection("Taskr"));

            Tag tag = db.Tags.SingleOrDefault(t => t.Id == tagId);

            if (tag == null)
            {
                throw new FaultException(string.Format("Tag with id {0} not exist", tagId));
            }

            try
            {
                db.Tags.DeleteOnSubmit(tag);
                db.SubmitChanges();
                return true;
            }
            catch
            {
                return false;
            }
        }
        public TaskDTO GetTask(Guid taskId)
        {
            if (taskId == Guid.Empty)
                throw new FaultException("Unable to retrieve task because the passed in id was empty");

            TaskrDataContext db = new TaskrDataContext(ConfigurationProvider.GetConnection("Taskr"));
            return TaskDTO.StaticMapFrom(db.Tasks.SingleOrDefault(t => t.Id == taskId));
        }
        public IList<TagDTO> ListTags()
        {
            TaskrDataContext db = new TaskrDataContext(ConfigurationProvider.GetConnection("Taskr"));
            IList<TagDTO> result = new List<TagDTO>();

            foreach (var item in db.Tags.OrderBy(t => t.Label))
            {
                result.Add(TagDTO.StaticMapFrom(item));
            }

            return result;
        }
        public Guid SaveTag(TagDTO tag)
        {
            Guid tagId = Guid.Empty;

            if (tag == null)
                throw new FaultException("Unable to save null tag.");

            TaskrDataContext db = new TaskrDataContext(ConfigurationProvider.GetConnection("Taskr"));

            if (tag.Id == Guid.Empty)
            {
                Tag _tag = tag.MapTo();
                tagId = _tag.Id;
                db.Tags.InsertOnSubmit(_tag);
            }
            else
            {
                Tag _tag = db.Tags.SingleOrDefault(t => t.Id == tag.Id);
                tag.MapInto(_tag);
                tagId = _tag.Id;
            }

            db.SubmitChanges();
            return tagId;
        }
        public Guid SaveTask(TaskDTO task)
        {
            Guid taskId = Guid.Empty;

            if (task == null)
                throw new FaultException("Unable to save null task");

            TaskrDataContext db = new TaskrDataContext(ConfigurationProvider.GetConnection("Taskr"));

            if (task.Id == Guid.Empty)
            {
                //If a new task is created, instruct SaaSGrid to adjust the limit counter appriopriately.
                MeterStatus result = SubscriptionContext.Instance.IncrementLimitCounter(Constants.FeatureNumberOfTasks);

                if (MeterStatus.NotExhausted == result)
                {
                    try
                    {
                        Task _task = task.MapTo();
                        db.Tasks.InsertOnSubmit(_task);
                        db.SubmitChanges();
                        taskId = _task.Id;
                    }
                    catch
                    {
                        SubscriptionContext.Instance.DecrementLimitCounter(Constants.FeatureNumberOfTasks);
                        throw;
                    }
                }
                else
                {
                    throw new LimiterExhaustedException
                    (
                        Constants.FeatureNumberOfTasks,
                        result,
                        Home.Resources.Task_MaximumLimitReached
                    );
                }
            }
            else
            {
                Task existingTask = db.Tasks.SingleOrDefault(t => t.Id == task.Id);
                task.MapInto(existingTask);
                db.SubmitChanges();
                taskId = existingTask.Id;
            }

            return taskId;
        }